protected void SeedDevOnlyEntries(AppCoreDbContext context) { var g = context.Set <TenancySecurityProfileRoleGroup>().Where(x => x.TenantFK == App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id).ToArray(); var r = context.Set <TenancySecurityProfileAccountRole>().Where(x => x.TenantFK == App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id).ToArray(); var records = new TenancySecurityProfile[] { new TenancySecurityProfile { Id = 1.ToGuid(), Key = "*****@*****.**", }, new TenancySecurityProfile { Id = 2.ToGuid(), Key = "*****@*****.**", Roles = new Collection <TenancySecurityProfileAccountRole>() { r.Where(x => x.Id == 3.ToGuid()).SingleOrDefault() } } }; var dbSet = context.Set <TenancySecurityProfile>(); dbSet.AddOrUpdate(p => p.Id, records); context.SaveChanges(); }
protected void SeedDevOnlyEntries(AppCoreDbContext context) { var r = context.Set <TenancySecurityProfileAccountRole>().Where(x => x.TenantFK == App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id).ToArray(); var records = new TenancySecurityProfileRoleGroup[] { new TenancySecurityProfileRoleGroup { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 1.ToGuid(), Title = "GroupA", Description = "...." }, new TenancySecurityProfileRoleGroup { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 2.ToGuid(), Title = "GroupB" }, new TenancySecurityProfileRoleGroup { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 3.ToGuid(), ParentFK = 2.ToGuid(), Title = "GroupB.1", Description = "A Group nested under GroupB" }, new TenancySecurityProfileRoleGroup { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 4.ToGuid(), ParentFK = 2.ToGuid(), Title = "GroupB.2", Description = "A Group nested under GroupB" }, new TenancySecurityProfileRoleGroup { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 5.ToGuid(), ParentFK = 4.ToGuid(), Title = "GroupB.2.1", Description = "A Group nested under GroupB.2", } }; var dbSet = context.Set <TenancySecurityProfileRoleGroup>(); dbSet.AddOrUpdate(p => p.Id, records); context.SaveChanges(); }
protected void SeedDevOnlyEntries(AppCoreDbContext context) { var p = context.Set <TenancySecurityProfilePermission>().Where(x => x.TenantFK == App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id).ToArray(); var records = new TenancySecurityProfileAccountRole[] { new TenancySecurityProfileAccountRole { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 1.ToGuid(), Title = "Role 1", Permissions = new Collection <TenancySecurityProfilePermission>() { p.Single(x => x.Id == 1.ToGuid()), p.Single(x => x.Id == 2.ToGuid()) } }, new TenancySecurityProfileAccountRole { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 2.ToGuid(), Title = "Role 2", Permissions = new Collection <TenancySecurityProfilePermission>() { p.Single(x => x.Id == 3.ToGuid()), p.Single(x => x.Id == 4.ToGuid()) } }, new TenancySecurityProfileAccountRole { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 3.ToGuid(), Title = "Role 3", Permissions = new Collection <TenancySecurityProfilePermission>() { p.Single(x => x.Id == 5.ToGuid()), p.Single(x => x.Id == 6.ToGuid()), p.Single(x => x.Id == 7.ToGuid()) } } }; var dbSet = context.Set <TenancySecurityProfileAccountRole>(); dbSet.AddOrUpdate(x => x.Id, records); context.SaveChanges(); }
protected void SeedDevOnlyEntries(AppCoreDbContext context) { var records = new[] { new Tenant { Id = Constants.Demo.Tenancies.A.Id, IsDefault = null, Enabled = true , Key = Constants.Demo.Tenancies.A.Key, DisplayName = Constants.Demo.Tenancies.A.Name, HostName = Constants.Demo.Tenancies.A.HostName }, new Tenant { Id = Constants.Demo.Tenancies.B.Id, IsDefault = null, Enabled = true, Key = Constants.Demo.Tenancies.B.Key, DisplayName = Constants.Demo.Tenancies.B.Name, HostName = Constants.Demo.Tenancies.B.HostName }, //new Tenant {Id=3.ToGuid(),IsDefault = null, Enabled=true, Key="OrgC", HostName =".C.",DisplayName="Org C, Inc."}, }; context.Set<Tenant>().AddOrUpdate(p => p.Id, records); }
/// <summary> /// Seed records that are part of this Module, no matter what (Immutable). /// <para> /// NOT the right place for demo entries, or data that will be updated /// by end users. /// </para> /// </summary> /// <param name="context"></param> protected void SeedImmutableEntries(AppCoreDbContext context) { { var records = new[] { //Policy and Privacy: new DataClassification { Id = NZDataClassification.Unspecified, Title = "Unspecified", DisplayOrderHint = 1 }, new DataClassification { Id = NZDataClassification.Unclassified, Title = "Unclassified", DisplayOrderHint = 2 }, new DataClassification { Id = NZDataClassification.InConfidence, Title = "In Confidence", DisplayOrderHint = 3 }, new DataClassification { Id = NZDataClassification.Sensitive, Title = "Sensitive", DisplayOrderHint = 4 }, //National Security: new DataClassification { Id = NZDataClassification.Restricted, Title = "Restricted", DisplayOrderHint = 5 }, new DataClassification { Id = NZDataClassification.Confidential, Title = "Confidential", DisplayOrderHint = 6 }, new DataClassification { Id = NZDataClassification.Secret, Title = "Secret", DisplayOrderHint = 7 }, new DataClassification { Id = NZDataClassification.TopSecret, Title = "TopSecret", DisplayOrderHint = 8 } }; context.Set <DataClassification>().AddOrUpdate(p => p.Id, records); context.SaveChanges(); } }
protected void SeedDevOnlyEntries(AppCoreDbContext context) { var records = new TenancySecurityProfilePermission[] { // for Role 1: new TenancySecurityProfilePermission { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 1.ToGuid(), Title = "Permission 1" }, new TenancySecurityProfilePermission { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 2.ToGuid(), Title = "Permission 2" }, // for Role 2: new TenancySecurityProfilePermission { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 3.ToGuid(), Title = "Permission 3" }, new TenancySecurityProfilePermission { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 4.ToGuid(), Title = "Permission 4" }, // for Role 3: new TenancySecurityProfilePermission { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 5.ToGuid(), Title = "Permission 5" }, new TenancySecurityProfilePermission { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 6.ToGuid(), Title = "Permission 6" }, new TenancySecurityProfilePermission { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, Id = 7.ToGuid(), Title = "Permission 7" } }; var dbSet = context.Set <TenancySecurityProfilePermission>(); dbSet.AddOrUpdate(p => p.Id, records); context.SaveChanges(); }
/// <summary> /// Seed records that are part of this Module, no matter what (Immutable). /// <para> /// NOT the right place for demo entries, or data that will be updated /// by end users. /// </para> /// </summary> /// <param name="context"></param> protected void SeedImmutableEntries(AppCoreDbContext context) { //TODO : Select to see if there is one with default first var records = new[] { App.Core.Infrastructure.Constants.Tenancy.Default.DefaultTenant }; context.Set<Tenant>().AddOrUpdate(p => p.Id, records); }
/// <summary> /// Seed records that are part of this Module, no matter what (Immutable). /// <para> /// NOT the right place for demo entries, or data that will be updated /// by end users. /// </para> /// </summary> /// <param name="context"></param> protected void SeedImmutableEntries(AppCoreDbContext context) { var records = new[] { //People: GetDefaultPrincipalCategory(), GetSystemPrincipalCategory(), }; context.Set <PrincipalCategory>().AddOrUpdate(p => p.Id, records); context.SaveChanges(); }
/// <summary> /// Seed records that are part of this Module, no matter what (Immutable). /// <para> /// NOT the right place for demo entries, or data that will be updated /// by end users. /// </para> /// </summary> /// <param name="context"></param> protected void SeedImmutableEntries(AppCoreDbContext context) { var records = new[] { new Principal { Id = Constants.Users.Anon.Id, Enabled = true, CategoryFK = 1.ToGuid(), DisplayName = Constants.Users.Anon.Name }, //new Principal {Id = Constants.Users.SysDaemon.Id, Enabled = true, CategoryFK = 2.ToGuid(), DisplayName = Constants.Users.SysDaemon.Name}, }; context.Set <Principal>().AddOrUpdate(p => p.Id, records); context.SaveChanges(); }
protected void SeedDevOnlyEntries(AppCoreDbContext context) { var records = new[] { new TenantClaim { Id = 1.ToGuid(), TenantFK = Constants.Demo.Tenancies.A.Id, Authority = "N/A", AuthoritySignature = "A", Key = "SomePropA", Value = "SomeValueA1" }, new TenantClaim { Id = 2.ToGuid(), TenantFK = Constants.Demo.Tenancies.A.Id, Authority = "N/A", AuthoritySignature = "A", Key = "SomePropB", Value = "SomeValueB1" }, new TenantClaim { Id = 3.ToGuid(), TenantFK = Constants.Demo.Tenancies.B.Id, Authority = "N/A", AuthoritySignature = "A", Key = "SomePropA", Value = "SomeValueA1" }, new TenantClaim { Id = 4.ToGuid(), TenantFK = Constants.Demo.Tenancies.B.Id, Authority = "N/A", AuthoritySignature = "A", Key = "SomePropB", Value = "SomeValueB1" } }; context.Set <TenantClaim>().AddOrUpdate(p => p.Id, records); }
protected void SeedDevOnlyEntries(AppCoreDbContext context) { var records = new [] { new Notification { Id = 1.ToGuid(), TenantFK = 1.ToGuid(), Type = NotificationType.Notification, Level = TraceLevel.Info, From = "System", Class = "xyz", ImageUrl = "...", Text = "Some Message about Foo.", DateTimeCreatedUtc = DateTime.UtcNow }, new Notification { Id = 2.ToGuid(), TenantFK = 1.ToGuid(), Type = NotificationType.Message, Level = TraceLevel.Warn, From = "System", Class = "xyz", ImageUrl = "...", Text = "Another Message for you.", DateTimeCreatedUtc = DateTime.UtcNow }, new Notification { Id = 3.ToGuid(), TenantFK = 1.ToGuid(), Type = NotificationType.Task, Level = TraceLevel.Info, From = "System", Class = "xyz", ImageUrl = "...", Text = "A Message you've read.", DateTimeCreatedUtc = DateTime.UtcNow, DateTimeReadUtc = DateTime.UtcNow } }; context.Set <Notification>().AddOrUpdate(p => p.Id, records); context.SaveChanges(); }
protected void SeedDevOnlyEntries(AppCoreDbContext context) { var records = new[] { //People: new SystemRole { Id = 1.ToGuid(), Enabled = false, ModuleKey = Constants.Module.Names.ModuleKey, Key = Constants.Roles.RoleKeys.SystemUser, DataClassificationFK = NZDataClassification.InConfidence, }, new SystemRole { Id = 2.ToGuid(), Enabled = false, ModuleKey = Constants.Module.Names.ModuleKey, Key = Constants.Roles.RoleKeys.SystemAdmin, DataClassificationFK = NZDataClassification.InConfidence, }, //People: new SystemRole { Id = 3.ToGuid(), Enabled = false, ModuleKey = Constants.Module.Names.ModuleKey, Key = Constants.Roles.RoleKeys.TenantMember, DataClassificationFK = NZDataClassification.InConfidence }, new SystemRole { Id = 4.ToGuid(), Enabled = false, ModuleKey = Constants.Module.Names.ModuleKey, Key = Constants.Roles.RoleKeys.TenantAdmin, DataClassificationFK = NZDataClassification.InConfidence, } }; context.Set <SystemRole>().AddOrUpdate(p => p.Id, records); context.SaveChanges(); }
protected void SeedDevOnlyEntries(AppCoreDbContext context) { var records = new[] { new TenantProperty { Id = 1.ToGuid(), TenantFK = Constants.Demo.Tenancies.B.Id, Key = "SomePropA", Value = "SomeValueA1" }, new TenantProperty { Id = 2.ToGuid(), TenantFK = Constants.Demo.Tenancies.B.Id, Key = "SomePropB", Value = "SomeValueB1" }, new TenantProperty { Id = 3.ToGuid(), TenantFK = Constants.Demo.Tenancies.B.Id, Key = "SomePropC", Value = "SomeValueC1" }, new TenantProperty { Id = 4.ToGuid(), TenantFK = Constants.Demo.Tenancies.B.Id, Key = "SomePropD", Value = "SomeValueD1" } }; context.Set <TenantProperty>().AddOrUpdate(p => p.Id, records); context.SaveChanges(); }
protected void SeedDevOnlyEntries(AppCoreDbContext context) { var records = new [] { new ExceptionRecord() { Id = 1.ToGuid(), Level = TraceLevel.Warn, Title = "Demo Warning", Stack = "blah...." }, new ExceptionRecord() { Id = 2.ToGuid(), Level = TraceLevel.Error, Title = "Demo Error", Stack = "blah again...." }, }; context.Set <ExceptionRecord>().AddOrUpdate(p => p.Id, records); context.SaveChanges(); }
protected void SeedDevOnlyEntries(AppCoreDbContext context) { var records = new TenancySecurityProfileRoleTenancySecurityProfilePermissionAssignment[] { // for Role 1: new TenancySecurityProfileRoleTenancySecurityProfilePermissionAssignment { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, RoleFK = 1.ToGuid(), PermissionFK = 1.ToGuid(), AssignmentType = AssignmentType.Add }, new TenancySecurityProfileRoleTenancySecurityProfilePermissionAssignment { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, RoleFK = 1.ToGuid(), PermissionFK = 2.ToGuid(), AssignmentType = AssignmentType.Add }, // for Role 2: new TenancySecurityProfileRoleTenancySecurityProfilePermissionAssignment { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, RoleFK = 2.ToGuid(), PermissionFK = 3.ToGuid(), AssignmentType = AssignmentType.Add }, new TenancySecurityProfileRoleTenancySecurityProfilePermissionAssignment { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, RoleFK = 2.ToGuid(), PermissionFK = 4.ToGuid(), AssignmentType = AssignmentType.Add }, // for Role 3: new TenancySecurityProfileRoleTenancySecurityProfilePermissionAssignment { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, RoleFK = 3.ToGuid(), PermissionFK = 5.ToGuid(), AssignmentType = AssignmentType.Add }, new TenancySecurityProfileRoleTenancySecurityProfilePermissionAssignment { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, RoleFK = 3.ToGuid(), PermissionFK = 6.ToGuid(), AssignmentType = AssignmentType.Add }, new TenancySecurityProfileRoleTenancySecurityProfilePermissionAssignment { TenantFK = App.Core.Infrastructure.Constants.Demo.Tenancies.A.Id, RoleFK = 3.ToGuid(), PermissionFK = 7.ToGuid(), AssignmentType = AssignmentType.Add }, }; var dbSet = context.Set <TenancySecurityProfileRoleTenancySecurityProfilePermissionAssignment>(); dbSet.AddOrUpdate(x => new { x.RoleFK, x.PermissionFK }, records); context.SaveChanges(); }