So let's start from features available within each of our guinea pigs. Following tables shows how different they are from that point of view
Custom Table | Module Class | |
---|---|---|
Fields | V | V + references to other tables |
Layout | V | V |
Transf | ||
Queries | V | |
Alternative | V | |
Search fields | V | |
UI | requires extra step, but gives you more options | |
Code | Info class | Info/InfoProvider classes |
Versions | V | |
Permissions | Predefined set of permissions | could be added manually |
I'm not going to go through the features, those are equal, only through different.
Performance is another good great thing to compare. To be as much accurate with the results as possible, I've created two, exactly the same, data structures and populated with the exact same data. Each table contains columns of different type:
Not too many columns, but, I guess, enough for this test.
I added 135168 records in each table and tried to select all of them, update one and delete one and here is what I got:
|
Module
|
Custom Table*
|
Custom Table
|
---|---|---|---|
SELECT ALL
|
2.3241329s
|
2.9881709S
|
3.0141724S
|
UPDATE
|
0.0190011S
|
0.0230013S
|
-
|
DELETE
|
0.0590034S
|
0.0600034S
|
-
|
*With Custom Table there are two methods to get data:
var records = CustomTableItemProvider . GetItems< ProductItem >() . ToList(); - returns ObjectQuery < ProductItem >
vs.
var records = CustomTableItemProvider . GetItems(customTableClassName) .ToList(); - returns ObjectQuery < CustomTableItem>
According to test results GetItems< ProductItem >() is some faster.
So Modules API seems to be a bit faster and might be considered with huge amount of data. I wouldn't say there is significant difference if we are talking about couple of thousands of records.
In my opinion, those two are great feature and there are cases when we should consider only one of them.
If I need to store and show tabular data, e.g. store hours, job titles, etc., I'd definitely go with Custom Table as it give us all we need out of the box: interface for an editor and a couple of web parts for showing data on the front end. In this case I don't even need to open Visual Studio. So, in general, this is simple and fast approach.
As we can see in the Features paragraph, Modules, usually, requires more efforts, meanwhile provides flexibility, allowing implementation of more advanced scenarios. I'd definitely consider this one when working with data structures consisting from many tables and having some relations in between them.
I hope this post will help you to make right decision and design application appropriately.
Please feel free to leave your feedback or share your experience with similar problems - we highly appreciate this!
Roman Hutnyk