Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the possibility to automatically load related tables #4

Closed
wants to merge 16 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Optimized eager loading of related tables. Queries are grouped by typ…
…e and partition key, much more efficient.
  • Loading branch information
petero-dk committed Mar 24, 2018
commit 43632dcf445a4b2e5a85f264c922d0723429e9e0
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@
<PackageReference Include="Handlebars.Net" Version="1.9.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Extensions\" />
<Folder Include="Delegates\" />
</ItemGroup>
</Project>
26 changes: 26 additions & 0 deletions CoreHelpers.WindowsAzure.Storage.Table/Extensions/TableQueryEx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Microsoft.WindowsAzure.Storage.Table;
using System;
using System.Collections.Generic;
using System.Text;

namespace CoreHelpers.WindowsAzure.Storage.Table.Extensions
{
public class TableQueryEx
{
public static string CheckAndCombineFilters(string filterA, string operatorString, string filterB)
{
if (string.IsNullOrWhiteSpace(filterA))
return filterB;

return TableQuery.CombineFilters(filterA, operatorString, filterA);
}

public static string CombineFilters(IEnumerable<string> filters, string operatorString)
{
return string.Join(
" " + operatorString + " ",
filters
);
}
}
}
17 changes: 17 additions & 0 deletions CoreHelpers.WindowsAzure.Storage.Table/RelatedTableItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace CoreHelpers.WindowsAzure.Storage.Table
{
internal class RelatedTableItem<T> where T : new()
{
public string RowKey { get; set; }
public string PartitionKey { get; set; }

public DynamicTableEntity<T> Model { get; set; }

public PropertyInfo Property { get; set; }
}
}
Loading