Added the possibility to automatically load related tables#4
Added the possibility to automatically load related tables#4petero-dk wants to merge 16 commits intoCoreHelpers:masterfrom
Conversation
…for null and set a variable in the if sentence structure (to save a method call)
Feature/relatedtables
Added ability to created StorageContext from connection string
|
I am considering a way to improve performance on eagerly loaded tables. As my current implementation would result in a lot of small requests immediately after a large one. I.e for a call with 100 rows there would be 1 + 100 calls. Any ideas? |
…e and partition key, much more efficient.
|
I have recreated the way to load eagerly loaded related tables, it is now resource efficient instead of making one query per related item. |
|
I tried to understand what the use case is but could you explain me what you try to achieve with the related table attribute? |
|
Hi @dei79 Sure, the idea is that it makes the library close to a drop-in replacement for entity framework, actually. Once I have set up the appropriate tables storageContext.AddAttributeMapperAndCreateTable<Models.Data.Country>();
storageContext.AddAttributeMapperAndCreateTable<Models.Data.Region>();I can load a single object in my controller like this: If the models are created like this: public class Region {
public string RegionRowKey {get;set;};
public string RegionPartitionKey {get;set;};
public string CountryRowKey {get;set;}
[RelatedTable("Countries", RowKey: "CountryRowKey")]
public Country CountryObject {get;set;}
}The I can reference the related object in the view just like this: <dt>
@Html.DisplayNameFor(model => model.Country)
</dt>
<dd>
@Html.DisplayFor(model => model.Country.Name)
</dd>That way I do not have to pass extra information to the view (which easily gets confusing if I send a list of objects) and I do not have to keep track of which objects have related tables loaded manually because either they directly have or they will (if I use the Lazy type) |
Added ability to created StorageContext from connection string
|
Sorry for the mess of commits above, I tried to sync the pr with your master. Does my explanation make any sense? |
…ureStorageTable into feature/relatedtables
|
I will be closing this soon, but I am just cleaning up in all the feature additions and bugfixes I have lying around for this project. I have tried to separate all individual changes out into different branches and PRs so every change is specific and identifiable. |
|
I would like to bring this change in the master but some checks are failing. Would it be ok for you to check this PR again? |
|
Yes, don't worry about this one, I will refactor it complete into the new master after all the other merges. |
|
Refactored to #21 |
The feature will automatically infer the rowkey if naming conventions are followed, and will automatically handle lazy loaded types.