public AttributedTableRepository(CloudStorageAccount storageAccount) : base(storageAccount, TableRepository.GetDefaultTableName <T>(), PartitionKeyAttribute.CreateAccessor <T>(), RowKeyAttribute.CreateAccessor <T>()) { }
public AttributedDocumentRepository(CloudStorageAccount storageAccount, IDocumentSerializer?serializer = default) : base(storageAccount, TableRepository.GetDefaultTableName <T>(), PartitionKeyAttribute.CreateCompiledAccessor <T>(), RowKeyAttribute.CreateCompiledAccessor <T>(), serializer ?? DocumentSerializer.Default) { }
public static string GetPartitionKeyName <T>(this T entity) where T : class { PropertyInfo[] props = typeof(T).GetProperties(); foreach (PropertyInfo prop in props) { object[] attrs = prop.GetCustomAttributes(true); foreach (object attr in attrs) { PartitionKeyAttribute pAttr = attr as PartitionKeyAttribute; if (pAttr != null) { return(prop.Name); } } } return(string.Empty); }