protected override void OnModelCreating(TableStorageModelBuilder modelbuilder) { modelbuilder.Entity<Scope>() .HasKeys(s => s.Name, s => "") .WithPropertyOf(s => s.Claims) .ToTable("Scopes"); modelbuilder.Entity<Client>() .HasKeys(c=>c.ClientId,c=>"") .WithEnumProperties() .WithUriProperties() .WithPropertyOf(c=>c.RedirectUris) .WithPropertyOf(c => c.ScopeRestrictions) .ToTable("Clients"); modelbuilder.Entity<AuthorizationCode>() .WithPropertyOf(code => code.Subject,SubjectDeserializer,SubjectSerializer) .WithPropertyOf(code => code.Client, (p)=> this.Clients.FindByKeysAsync(p.StringValue,""), p=>Task.FromResult(new EntityProperty(p.ClientId))) .WithPropertyOf(code=>code.RequestedScopes) .WithUriProperties() .ToTable("AuthorizationCodes"); modelbuilder.Entity<Token>() .WithNoneDefaultConstructor((props) => new Token(props["Type"].StringValue)) .WithPropertyOf(token => token.Client, (p) => this.Clients.FindByKeysAsync(p.StringValue, ""), p => Task.FromResult(new EntityProperty(p.ClientId))) .WithPropertyOf(token=>token.Claims) .ToTable("Tokens"); base.OnModelCreating(modelbuilder); }
protected override void OnModelCreating(TableStorageModelBuilder modelbuilder) { modelbuilder.Entity <EmailSendtModel>() .HasKeys(k => new { k.EmailId }) .WithKeyPropertyTransformation(k => k.EmailId, s => s.CreateMD5()) .ToTable("emails"); modelbuilder.Entity <EmailTemplateModel>() .HasKeys(k => new { k.EmailIdHash }) .WithKeyPropertyTransformation(k => k.EmailIdHash, s => $"template__{s}") .WithPropertyOf(k => k.Tags) .ToTable("emails"); base.OnModelCreating(modelbuilder); }
protected override void OnModelCreating(TableStorageModelBuilder modelbuilder) { modelbuilder.Entity<Product>() .HasKeys(pk => pk.Category, rk =>new { rk.Store, rk.ProductId}) .ToTable("unittest7"); base.OnModelCreating(modelbuilder); }
protected override void OnModelCreating( TableStorageModelBuilder modelbuilder) { modelbuilder.Entity<TimeEntity>() .HasKeys( m => new { m.Id1, m.Time }, m => m.Id2) .WithKeyPropertyTransformation(m =>m.Time,t) .ToTable("test6"); }
protected override void OnModelCreating(TableStorageModelBuilder modelbuilder) { modelbuilder.Entity <PersistedGrant>() .HasKeys(k => new { k.SubjectId, k.ClientId }, r => new { r.Type, r.Key }) .WithIndex(k => k.Key, true, TABLENAME) .WithKeyTransformation(k => k.Key, FixPartitionKey) .ToTable(TABLENAME); base.OnModelCreating(modelbuilder); }
protected override void OnModelCreating(TableStorageModelBuilder modelbuilder) { modelbuilder.Entity<MyModel>() .UseBase64EncodingFor(m => m.Item2) .HasKeys(m => m.Item1, m => "") .WithIndex(m => new { m.Item2, m.Item3 }) .ToTable("testTable003"); base.OnModelCreating(modelbuilder); }
protected override void OnModelCreating(TableStorageModelBuilder modelbuilder) { modelbuilder.Entity<SubItem>().HasKeys(t=>t.Name,t=>t.LastName).ToTable("testtable"); modelbuilder.Entity<MyTestPoco>() .HasKeys(y => y.Name, y => y.LastName) .WithCollectionOf(t => t.Items, (source, item) => (from i in source where i.Name == item.Name select i)) .ToTable("testsfds"); modelbuilder.Entity<MyTestPocoEntity>() .HasKeys(y => y.Name, y => y.LastName) .WithCollectionOf(t=>t.Items,(source,item) => (from i in source where i.Name == item.Name select i)) .ToTable("testsfds"); modelbuilder.Entity<MyTestClass>() .HasKeys(y => y.LolKey, t => "") .WithPropertyOf(t => t.Items)//, // p => JsonConvert.DeserializeObject<List<SubItem>>(p.StringValue), // p => new EntityProperty(JsonConvert.SerializeObject(p))) .ToTable("tesdsfaa"); base.OnModelCreating(modelbuilder); }