12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127 |
- using System;
- using System.Collections.Generic;
- using CodeFirstExistingDatabaseSample.ReportServer.Models;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata;
- namespace CodeFirstExistingDatabaseSample
- {
- public partial class ReportServerContext : DbContext
- {
- public ReportServerContext()
- {
- }
- public ReportServerContext(DbContextOptions<ReportServerContext> options)
- : base(options)
- {
- }
- public virtual DbSet<ActiveSubscription> ActiveSubscriptions { get; set; } = null!;
- public virtual DbSet<Batch> Batches { get; set; } = null!;
- public virtual DbSet<CachePolicy> CachePolicies { get; set; } = null!;
- public virtual DbSet<Catalog> Catalogs { get; set; } = null!;
- public virtual DbSet<ChunkDatum> ChunkData { get; set; } = null!;
- public virtual DbSet<ChunkSegmentMapping> ChunkSegmentMappings { get; set; } = null!;
- public virtual DbSet<ConfigurationInfo> ConfigurationInfos { get; set; } = null!;
- public virtual DbSet<DataSet> DataSets { get; set; } = null!;
- public virtual DbSet<DataSource> DataSources { get; set; } = null!;
- public virtual DbSet<DbupgradeHistory> DbupgradeHistories { get; set; } = null!;
- public virtual DbSet<Event> Events { get; set; } = null!;
- public virtual DbSet<ExecutionLog> ExecutionLogs { get; set; } = null!;
- public virtual DbSet<ExecutionLog2> ExecutionLog2s { get; set; } = null!;
- public virtual DbSet<ExecutionLog3> ExecutionLog3s { get; set; } = null!;
- public virtual DbSet<ExecutionLogStorage> ExecutionLogStorages { get; set; } = null!;
- public virtual DbSet<ExtendedDataSet> ExtendedDataSets { get; set; } = null!;
- public virtual DbSet<ExtendedDataSource> ExtendedDataSources { get; set; } = null!;
- public virtual DbSet<History> Histories { get; set; } = null!;
- public virtual DbSet<Key> Keys { get; set; } = null!;
- public virtual DbSet<ModelDrill> ModelDrills { get; set; } = null!;
- public virtual DbSet<ModelItemPolicy> ModelItemPolicies { get; set; } = null!;
- public virtual DbSet<ModelPerspective> ModelPerspectives { get; set; } = null!;
- public virtual DbSet<Notification> Notifications { get; set; } = null!;
- public virtual DbSet<Policy> Policies { get; set; } = null!;
- public virtual DbSet<PolicyUserRole> PolicyUserRoles { get; set; } = null!;
- public virtual DbSet<ReportSchedule> ReportSchedules { get; set; } = null!;
- public virtual DbSet<Role> Roles { get; set; } = null!;
- public virtual DbSet<RunningJob> RunningJobs { get; set; } = null!;
- public virtual DbSet<Schedule> Schedules { get; set; } = null!;
- public virtual DbSet<SecDatum> SecData { get; set; } = null!;
- public virtual DbSet<Segment> Segments { get; set; } = null!;
- public virtual DbSet<SegmentedChunk> SegmentedChunks { get; set; } = null!;
- public virtual DbSet<ServerParametersInstance> ServerParametersInstances { get; set; } = null!;
- public virtual DbSet<ServerUpgradeHistory> ServerUpgradeHistories { get; set; } = null!;
- public virtual DbSet<SnapshotDatum> SnapshotData { get; set; } = null!;
- public virtual DbSet<Subscription> Subscriptions { get; set; } = null!;
- public virtual DbSet<SubscriptionsBeingDeleted> SubscriptionsBeingDeleteds { get; set; } = null!;
- public virtual DbSet<UpgradeInfo> UpgradeInfos { get; set; } = null!;
- public virtual DbSet<User> Users { get; set; } = null!;
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- if (!optionsBuilder.IsConfigured)
- {
- optionsBuilder.UseSqlServer("Server=192.168.110.161;User ID=sa;Password=sa;Database=ReportServer;Trusted_Connection=False;");
- }
- }
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.UseCollation("Latin1_General_CI_AS_KS_WS");
- modelBuilder.Entity<ActiveSubscription>(entity =>
- {
- entity.HasKey(e => e.ActiveId);
- entity.Property(e => e.ActiveId)
- .ValueGeneratedNever()
- .HasColumnName("ActiveID");
- entity.Property(e => e.SubscriptionId).HasColumnName("SubscriptionID");
- entity.HasOne(d => d.Subscription)
- .WithMany(p => p.ActiveSubscriptions)
- .HasForeignKey(d => d.SubscriptionId)
- .HasConstraintName("FK_ActiveSubscriptions_Subscriptions");
- });
- modelBuilder.Entity<Batch>(entity =>
- {
- entity.HasNoKey();
- entity.ToTable("Batch");
- entity.HasIndex(e => new { e.BatchId, e.AddedOn }, "IX_Batch")
- .IsClustered();
- entity.HasIndex(e => e.AddedOn, "IX_Batch_1");
- entity.Property(e => e.Action)
- .HasMaxLength(32)
- .IsUnicode(false);
- entity.Property(e => e.AddedOn).HasColumnType("datetime");
- entity.Property(e => e.BatchId).HasColumnName("BatchID");
- entity.Property(e => e.Content).HasColumnType("image");
- entity.Property(e => e.Item).HasMaxLength(425);
- entity.Property(e => e.Param).HasMaxLength(425);
- entity.Property(e => e.Parent).HasMaxLength(425);
- entity.Property(e => e.Properties).HasColumnType("ntext");
- });
- modelBuilder.Entity<CachePolicy>(entity =>
- {
- entity.HasKey(e => e.CachePolicyId)
- .IsClustered(false);
- entity.ToTable("CachePolicy");
- entity.HasIndex(e => e.ReportId, "IX_CachePolicyReportID")
- .IsUnique()
- .IsClustered();
- entity.Property(e => e.CachePolicyId)
- .ValueGeneratedNever()
- .HasColumnName("CachePolicyID");
- entity.Property(e => e.ReportId).HasColumnName("ReportID");
- entity.HasOne(d => d.Report)
- .WithOne(p => p.CachePolicy)
- .HasForeignKey<CachePolicy>(d => d.ReportId)
- .HasConstraintName("FK_CachePolicyReportID");
- });
- modelBuilder.Entity<Catalog>(entity =>
- {
- entity.HasKey(e => e.ItemId)
- .IsClustered(false);
- entity.ToTable("Catalog");
- entity.HasIndex(e => e.Path, "IX_Catalog")
- .IsUnique()
- .IsClustered();
- entity.HasIndex(e => new { e.Type, e.ComponentId }, "IX_ComponentLookup");
- entity.HasIndex(e => e.LinkSourceId, "IX_Link");
- entity.HasIndex(e => e.ParentId, "IX_Parent");
- entity.HasIndex(e => e.SnapshotDataId, "IX_SnapshotDataId");
- entity.Property(e => e.ItemId)
- .ValueGeneratedNever()
- .HasColumnName("ItemID");
- entity.Property(e => e.ComponentId).HasColumnName("ComponentID");
- entity.Property(e => e.Content).HasColumnType("image");
- entity.Property(e => e.CreatedById).HasColumnName("CreatedByID");
- entity.Property(e => e.CreationDate).HasColumnType("datetime");
- entity.Property(e => e.Description).HasMaxLength(512);
- entity.Property(e => e.ExecutionTime).HasColumnType("datetime");
- entity.Property(e => e.LinkSourceId).HasColumnName("LinkSourceID");
- entity.Property(e => e.MimeType).HasMaxLength(260);
- entity.Property(e => e.ModifiedById).HasColumnName("ModifiedByID");
- entity.Property(e => e.ModifiedDate).HasColumnType("datetime");
- entity.Property(e => e.Name).HasMaxLength(425);
- entity.Property(e => e.Parameter).HasColumnType("ntext");
- entity.Property(e => e.ParentId).HasColumnName("ParentID");
- entity.Property(e => e.Path).HasMaxLength(425);
- entity.Property(e => e.PolicyId).HasColumnName("PolicyID");
- entity.Property(e => e.Property).HasColumnType("ntext");
- entity.Property(e => e.SnapshotDataId).HasColumnName("SnapshotDataID");
- entity.Property(e => e.SubType).HasMaxLength(128);
- entity.HasOne(d => d.CreatedBy)
- .WithMany(p => p.CatalogCreatedBies)
- .HasForeignKey(d => d.CreatedById)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("FK_Catalog_CreatedByID");
- entity.HasOne(d => d.LinkSource)
- .WithMany(p => p.InverseLinkSource)
- .HasForeignKey(d => d.LinkSourceId)
- .HasConstraintName("FK_Catalog_LinkSourceID");
- entity.HasOne(d => d.ModifiedBy)
- .WithMany(p => p.CatalogModifiedBies)
- .HasForeignKey(d => d.ModifiedById)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("FK_Catalog_ModifiedByID");
- entity.HasOne(d => d.Parent)
- .WithMany(p => p.InverseParent)
- .HasForeignKey(d => d.ParentId)
- .HasConstraintName("FK_Catalog_ParentID");
- entity.HasOne(d => d.Policy)
- .WithMany(p => p.Catalogs)
- .HasForeignKey(d => d.PolicyId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("FK_Catalog_Policy");
- });
- modelBuilder.Entity<ChunkDatum>(entity =>
- {
- entity.HasKey(e => e.ChunkId)
- .IsClustered(false);
- entity.HasIndex(e => new { e.SnapshotDataId, e.ChunkType, e.ChunkName }, "IX_ChunkData")
- .IsUnique()
- .IsClustered();
- entity.Property(e => e.ChunkId)
- .ValueGeneratedNever()
- .HasColumnName("ChunkID");
- entity.Property(e => e.ChunkName).HasMaxLength(260);
- entity.Property(e => e.Content).HasColumnType("image");
- entity.Property(e => e.MimeType).HasMaxLength(260);
- entity.Property(e => e.SnapshotDataId).HasColumnName("SnapshotDataID");
- });
- modelBuilder.Entity<ChunkSegmentMapping>(entity =>
- {
- entity.HasKey(e => new { e.ChunkId, e.SegmentId });
- entity.ToTable("ChunkSegmentMapping");
- entity.HasIndex(e => e.SegmentId, "IX_ChunkSegmentMapping_SegmentId");
- entity.HasIndex(e => new { e.ChunkId, e.StartByte }, "UNIQ_ChunkId_StartByte")
- .IsUnique();
- });
- modelBuilder.Entity<ConfigurationInfo>(entity =>
- {
- entity.HasKey(e => e.ConfigInfoId)
- .IsClustered(false);
- entity.ToTable("ConfigurationInfo");
- entity.HasIndex(e => e.Name, "IX_ConfigurationInfo")
- .IsUnique()
- .IsClustered();
- entity.Property(e => e.ConfigInfoId)
- .ValueGeneratedNever()
- .HasColumnName("ConfigInfoID");
- entity.Property(e => e.Name).HasMaxLength(260);
- entity.Property(e => e.Value).HasColumnType("ntext");
- });
- modelBuilder.Entity<DataSet>(entity =>
- {
- entity.HasKey(e => e.Id)
- .HasName("PK_DataSet")
- .IsClustered(false);
- entity.HasIndex(e => e.LinkId, "IX_DataSetLinkID");
- entity.HasIndex(e => new { e.ItemId, e.Name }, "IX_DataSet_ItemID_Name")
- .IsClustered();
- entity.Property(e => e.Id)
- .ValueGeneratedNever()
- .HasColumnName("ID");
- entity.Property(e => e.ItemId).HasColumnName("ItemID");
- entity.Property(e => e.LinkId).HasColumnName("LinkID");
- entity.Property(e => e.Name).HasMaxLength(260);
- entity.HasOne(d => d.Item)
- .WithMany(p => p.DataSetItems)
- .HasForeignKey(d => d.ItemId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("FK_DataSetItemID");
- entity.HasOne(d => d.Link)
- .WithMany(p => p.DataSetLinks)
- .HasForeignKey(d => d.LinkId)
- .HasConstraintName("FK_DataSetLinkID");
- });
- modelBuilder.Entity<DataSource>(entity =>
- {
- entity.HasKey(e => e.Dsid);
- entity.ToTable("DataSource");
- entity.HasIndex(e => e.ItemId, "IX_DataSourceItemID");
- entity.HasIndex(e => e.SubscriptionId, "IX_DataSourceSubscriptionID");
- entity.Property(e => e.Dsid)
- .ValueGeneratedNever()
- .HasColumnName("DSID");
- entity.Property(e => e.ConnectionString).HasColumnType("image");
- entity.Property(e => e.Extension).HasMaxLength(260);
- entity.Property(e => e.ItemId).HasColumnName("ItemID");
- entity.Property(e => e.Name).HasMaxLength(260);
- entity.Property(e => e.OriginalConnectionString).HasColumnType("image");
- entity.Property(e => e.Password).HasColumnType("image");
- entity.Property(e => e.Prompt).HasColumnType("ntext");
- entity.Property(e => e.SubscriptionId).HasColumnName("SubscriptionID");
- entity.Property(e => e.UserName).HasColumnType("image");
- entity.HasOne(d => d.Item)
- .WithMany(p => p.DataSources)
- .HasForeignKey(d => d.ItemId)
- .HasConstraintName("FK_DataSourceItemID");
- });
- modelBuilder.Entity<DbupgradeHistory>(entity =>
- {
- entity.HasKey(e => e.UpgradeId);
- entity.ToTable("DBUpgradeHistory");
- entity.Property(e => e.UpgradeId).HasColumnName("UpgradeID");
- entity.Property(e => e.DateTime)
- .HasColumnType("datetime")
- .HasDefaultValueSql("(getdate())");
- entity.Property(e => e.DbVersion).HasMaxLength(25);
- entity.Property(e => e.User)
- .HasMaxLength(128)
- .HasDefaultValueSql("(suser_sname())");
- });
- modelBuilder.Entity<Event>(entity =>
- {
- entity.ToTable("Event");
- entity.HasIndex(e => e.ProcessStart, "IX_Event2");
- entity.HasIndex(e => e.TimeEntered, "IX_Event_TimeEntered");
- entity.Property(e => e.EventId)
- .ValueGeneratedNever()
- .HasColumnName("EventID");
- entity.Property(e => e.BatchId).HasColumnName("BatchID");
- entity.Property(e => e.EventData).HasMaxLength(260);
- entity.Property(e => e.EventType).HasMaxLength(260);
- entity.Property(e => e.ProcessHeartbeat).HasColumnType("datetime");
- entity.Property(e => e.ProcessStart).HasColumnType("datetime");
- entity.Property(e => e.TimeEntered).HasColumnType("datetime");
- });
- modelBuilder.Entity<ExecutionLog>(entity =>
- {
- entity.HasNoKey();
- entity.ToView("ExecutionLog");
- entity.Property(e => e.Format).HasMaxLength(26);
- entity.Property(e => e.InstanceName).HasMaxLength(38);
- entity.Property(e => e.Parameters).HasColumnType("ntext");
- entity.Property(e => e.ReportId).HasColumnName("ReportID");
- entity.Property(e => e.Status).HasMaxLength(40);
- entity.Property(e => e.TimeEnd).HasColumnType("datetime");
- entity.Property(e => e.TimeStart).HasColumnType("datetime");
- entity.Property(e => e.UserName).HasMaxLength(260);
- });
- modelBuilder.Entity<ExecutionLog2>(entity =>
- {
- entity.HasNoKey();
- entity.ToView("ExecutionLog2");
- entity.Property(e => e.AdditionalInfo).HasColumnType("xml");
- entity.Property(e => e.ExecutionId).HasMaxLength(64);
- entity.Property(e => e.Format).HasMaxLength(26);
- entity.Property(e => e.InstanceName).HasMaxLength(38);
- entity.Property(e => e.Parameters).HasColumnType("ntext");
- entity.Property(e => e.ReportAction)
- .HasMaxLength(21)
- .IsUnicode(false);
- entity.Property(e => e.ReportPath).HasMaxLength(425);
- entity.Property(e => e.RequestType)
- .HasMaxLength(12)
- .IsUnicode(false);
- entity.Property(e => e.Source)
- .HasMaxLength(8)
- .IsUnicode(false);
- entity.Property(e => e.Status).HasMaxLength(40);
- entity.Property(e => e.TimeEnd).HasColumnType("datetime");
- entity.Property(e => e.TimeStart).HasColumnType("datetime");
- entity.Property(e => e.UserName).HasMaxLength(260);
- });
- modelBuilder.Entity<ExecutionLog3>(entity =>
- {
- entity.HasNoKey();
- entity.ToView("ExecutionLog3");
- entity.Property(e => e.AdditionalInfo).HasColumnType("xml");
- entity.Property(e => e.ExecutionId).HasMaxLength(64);
- entity.Property(e => e.Format).HasMaxLength(26);
- entity.Property(e => e.InstanceName).HasMaxLength(38);
- entity.Property(e => e.ItemAction)
- .HasMaxLength(21)
- .IsUnicode(false);
- entity.Property(e => e.ItemPath).HasMaxLength(425);
- entity.Property(e => e.Parameters).HasColumnType("ntext");
- entity.Property(e => e.RequestType)
- .HasMaxLength(13)
- .IsUnicode(false);
- entity.Property(e => e.Source)
- .HasMaxLength(8)
- .IsUnicode(false);
- entity.Property(e => e.Status).HasMaxLength(40);
- entity.Property(e => e.TimeEnd).HasColumnType("datetime");
- entity.Property(e => e.TimeStart).HasColumnType("datetime");
- entity.Property(e => e.UserName).HasMaxLength(260);
- });
- modelBuilder.Entity<ExecutionLogStorage>(entity =>
- {
- entity.HasKey(e => e.LogEntryId)
- .HasName("PK__Executio__05F5D745E1B95E21");
- entity.ToTable("ExecutionLogStorage");
- entity.HasIndex(e => new { e.TimeStart, e.LogEntryId }, "IX_ExecutionLog");
- entity.Property(e => e.AdditionalInfo).HasColumnType("xml");
- entity.Property(e => e.ExecutionId).HasMaxLength(64);
- entity.Property(e => e.Format).HasMaxLength(26);
- entity.Property(e => e.InstanceName).HasMaxLength(38);
- entity.Property(e => e.Parameters).HasColumnType("ntext");
- entity.Property(e => e.ReportId).HasColumnName("ReportID");
- entity.Property(e => e.Status).HasMaxLength(40);
- entity.Property(e => e.TimeEnd).HasColumnType("datetime");
- entity.Property(e => e.TimeStart).HasColumnType("datetime");
- entity.Property(e => e.UserName).HasMaxLength(260);
- });
- modelBuilder.Entity<ExtendedDataSet>(entity =>
- {
- entity.HasNoKey();
- entity.ToView("ExtendedDataSets");
- entity.Property(e => e.Id).HasColumnName("ID");
- entity.Property(e => e.ItemId).HasColumnName("ItemID");
- entity.Property(e => e.LinkId).HasColumnName("LinkID");
- entity.Property(e => e.Name).HasMaxLength(260);
- });
- modelBuilder.Entity<ExtendedDataSource>(entity =>
- {
- entity.HasNoKey();
- entity.ToView("ExtendedDataSources");
- entity.Property(e => e.ConnectionString).HasColumnType("image");
- entity.Property(e => e.Dsid).HasColumnName("DSID");
- entity.Property(e => e.Extension).HasMaxLength(260);
- entity.Property(e => e.ItemId).HasColumnName("ItemID");
- entity.Property(e => e.Name).HasMaxLength(260);
- entity.Property(e => e.OriginalConnectionString).HasColumnType("image");
- entity.Property(e => e.Password).HasColumnType("image");
- entity.Property(e => e.Prompt).HasColumnType("ntext");
- entity.Property(e => e.SubscriptionId).HasColumnName("SubscriptionID");
- entity.Property(e => e.UserName).HasColumnType("image");
- });
- modelBuilder.Entity<History>(entity =>
- {
- entity.HasKey(e => e.HistoryId)
- .IsClustered(false);
- entity.ToTable("History");
- entity.HasIndex(e => new { e.ReportId, e.SnapshotDate }, "IX_History")
- .IsUnique()
- .IsClustered();
- entity.HasIndex(e => e.SnapshotDataId, "IX_SnapshotDataID");
- entity.Property(e => e.HistoryId)
- .ValueGeneratedNever()
- .HasColumnName("HistoryID");
- entity.Property(e => e.ReportId).HasColumnName("ReportID");
- entity.Property(e => e.SnapshotDataId).HasColumnName("SnapshotDataID");
- entity.Property(e => e.SnapshotDate).HasColumnType("datetime");
- });
- modelBuilder.Entity<Key>(entity =>
- {
- entity.HasKey(e => new { e.InstallationId, e.Client });
- entity.Property(e => e.InstallationId).HasColumnName("InstallationID");
- entity.Property(e => e.InstanceName).HasMaxLength(32);
- entity.Property(e => e.MachineName).HasMaxLength(256);
- entity.Property(e => e.PublicKey).HasColumnType("image");
- entity.Property(e => e.SymmetricKey).HasColumnType("image");
- });
- modelBuilder.Entity<ModelDrill>(entity =>
- {
- entity.HasKey(e => e.ModelDrillId)
- .IsClustered(false);
- entity.ToTable("ModelDrill");
- entity.HasIndex(e => new { e.ModelId, e.ReportId, e.ModelDrillId }, "IX_ModelDrillModelID")
- .IsUnique()
- .IsClustered();
- entity.Property(e => e.ModelDrillId)
- .ValueGeneratedNever()
- .HasColumnName("ModelDrillID");
- entity.Property(e => e.ModelId).HasColumnName("ModelID");
- entity.Property(e => e.ModelItemId)
- .HasMaxLength(425)
- .HasColumnName("ModelItemID");
- entity.Property(e => e.ReportId).HasColumnName("ReportID");
- entity.HasOne(d => d.Model)
- .WithMany(p => p.ModelDrillModels)
- .HasForeignKey(d => d.ModelId)
- .HasConstraintName("FK_ModelDrillModel");
- entity.HasOne(d => d.Report)
- .WithMany(p => p.ModelDrillReports)
- .HasForeignKey(d => d.ReportId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("FK_ModelDrillReport");
- });
- modelBuilder.Entity<ModelItemPolicy>(entity =>
- {
- entity.HasKey(e => e.Id)
- .IsClustered(false);
- entity.ToTable("ModelItemPolicy");
- entity.HasIndex(e => new { e.CatalogItemId, e.ModelItemId }, "IX_ModelItemPolicy")
- .IsClustered();
- entity.Property(e => e.Id)
- .ValueGeneratedNever()
- .HasColumnName("ID");
- entity.Property(e => e.CatalogItemId).HasColumnName("CatalogItemID");
- entity.Property(e => e.ModelItemId)
- .HasMaxLength(425)
- .HasColumnName("ModelItemID");
- entity.Property(e => e.PolicyId).HasColumnName("PolicyID");
- entity.HasOne(d => d.Policy)
- .WithMany(p => p.ModelItemPolicies)
- .HasForeignKey(d => d.PolicyId)
- .HasConstraintName("FK_PoliciesPolicyID");
- });
- modelBuilder.Entity<ModelPerspective>(entity =>
- {
- entity.HasNoKey();
- entity.ToTable("ModelPerspective");
- entity.HasIndex(e => e.ModelId, "IX_ModelPerspective")
- .IsClustered();
- entity.Property(e => e.Id).HasColumnName("ID");
- entity.Property(e => e.ModelId).HasColumnName("ModelID");
- entity.Property(e => e.PerspectiveDescription).HasColumnType("ntext");
- entity.Property(e => e.PerspectiveId)
- .HasColumnType("ntext")
- .HasColumnName("PerspectiveID");
- entity.Property(e => e.PerspectiveName).HasColumnType("ntext");
- entity.HasOne(d => d.Model)
- .WithMany()
- .HasForeignKey(d => d.ModelId)
- .HasConstraintName("FK_ModelPerspectiveModel");
- });
- modelBuilder.Entity<Notification>(entity =>
- {
- entity.HasIndex(e => e.ProcessAfter, "IX_Notifications");
- entity.HasIndex(e => e.ProcessStart, "IX_Notifications2");
- entity.HasIndex(e => e.NotificationEntered, "IX_Notifications3");
- entity.Property(e => e.NotificationId)
- .ValueGeneratedNever()
- .HasColumnName("NotificationID");
- entity.Property(e => e.ActivationId).HasColumnName("ActivationID");
- entity.Property(e => e.BatchId).HasColumnName("BatchID");
- entity.Property(e => e.DeliveryExtension).HasMaxLength(260);
- entity.Property(e => e.ExtensionSettings).HasColumnType("ntext");
- entity.Property(e => e.Locale).HasMaxLength(128);
- entity.Property(e => e.NotificationEntered).HasColumnType("datetime");
- entity.Property(e => e.Parameters).HasColumnType("ntext");
- entity.Property(e => e.ProcessAfter).HasColumnType("datetime");
- entity.Property(e => e.ProcessHeartbeat).HasColumnType("datetime");
- entity.Property(e => e.ProcessStart).HasColumnType("datetime");
- entity.Property(e => e.ReportId).HasColumnName("ReportID");
- entity.Property(e => e.SnapShotDate).HasColumnType("datetime");
- entity.Property(e => e.SubscriptionId).HasColumnName("SubscriptionID");
- entity.Property(e => e.SubscriptionLastRunTime).HasColumnType("datetime");
- entity.Property(e => e.SubscriptionOwnerId).HasColumnName("SubscriptionOwnerID");
- entity.HasOne(d => d.Subscription)
- .WithMany(p => p.Notifications)
- .HasForeignKey(d => d.SubscriptionId)
- .HasConstraintName("FK_Notifications_Subscriptions");
- });
- modelBuilder.Entity<Policy>(entity =>
- {
- entity.Property(e => e.PolicyId)
- .ValueGeneratedNever()
- .HasColumnName("PolicyID");
- });
- modelBuilder.Entity<PolicyUserRole>(entity =>
- {
- entity.HasKey(e => e.Id)
- .IsClustered(false);
- entity.ToTable("PolicyUserRole");
- entity.HasIndex(e => new { e.RoleId, e.UserId, e.PolicyId }, "IX_PolicyUserRole")
- .IsUnique()
- .IsClustered();
- entity.Property(e => e.Id)
- .ValueGeneratedNever()
- .HasColumnName("ID");
- entity.Property(e => e.PolicyId).HasColumnName("PolicyID");
- entity.Property(e => e.RoleId).HasColumnName("RoleID");
- entity.Property(e => e.UserId).HasColumnName("UserID");
- entity.HasOne(d => d.Policy)
- .WithMany(p => p.PolicyUserRoles)
- .HasForeignKey(d => d.PolicyId)
- .HasConstraintName("FK_PolicyUserRole_Policy");
- entity.HasOne(d => d.Role)
- .WithMany(p => p.PolicyUserRoles)
- .HasForeignKey(d => d.RoleId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("FK_PolicyUserRole_Role");
- entity.HasOne(d => d.User)
- .WithMany(p => p.PolicyUserRoles)
- .HasForeignKey(d => d.UserId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("FK_PolicyUserRole_User");
- });
- modelBuilder.Entity<ReportSchedule>(entity =>
- {
- entity.HasNoKey();
- entity.ToTable("ReportSchedule");
- entity.HasIndex(e => e.ReportId, "IX_ReportSchedule_ReportID");
- entity.HasIndex(e => e.ScheduleId, "IX_ReportSchedule_ScheduleID");
- entity.HasIndex(e => e.SubscriptionId, "IX_ReportSchedule_SubscriptionID");
- entity.Property(e => e.ReportId).HasColumnName("ReportID");
- entity.Property(e => e.ScheduleId).HasColumnName("ScheduleID");
- entity.Property(e => e.SubscriptionId).HasColumnName("SubscriptionID");
- entity.HasOne(d => d.Report)
- .WithMany()
- .HasForeignKey(d => d.ReportId)
- .HasConstraintName("FK_ReportSchedule_Report");
- entity.HasOne(d => d.Schedule)
- .WithMany()
- .HasForeignKey(d => d.ScheduleId)
- .HasConstraintName("FK_ReportSchedule_Schedule");
- entity.HasOne(d => d.Subscription)
- .WithMany()
- .HasForeignKey(d => d.SubscriptionId)
- .HasConstraintName("FK_ReportSchedule_Subscriptions");
- });
- modelBuilder.Entity<Role>(entity =>
- {
- entity.HasKey(e => e.RoleId)
- .IsClustered(false);
- entity.HasIndex(e => e.RoleName, "IX_Roles")
- .IsUnique()
- .IsClustered();
- entity.Property(e => e.RoleId)
- .ValueGeneratedNever()
- .HasColumnName("RoleID");
- entity.Property(e => e.Description).HasMaxLength(512);
- entity.Property(e => e.RoleName).HasMaxLength(260);
- entity.Property(e => e.TaskMask).HasMaxLength(32);
- });
- modelBuilder.Entity<RunningJob>(entity =>
- {
- entity.HasKey(e => e.JobId);
- entity.HasIndex(e => new { e.ComputerName, e.JobType }, "IX_RunningJobsStatus");
- entity.Property(e => e.JobId)
- .HasMaxLength(32)
- .HasColumnName("JobID");
- entity.Property(e => e.ComputerName).HasMaxLength(32);
- entity.Property(e => e.Description).HasColumnType("ntext");
- entity.Property(e => e.RequestName).HasMaxLength(425);
- entity.Property(e => e.RequestPath).HasMaxLength(425);
- entity.Property(e => e.StartDate).HasColumnType("datetime");
- });
- modelBuilder.Entity<Schedule>(entity =>
- {
- entity.ToTable("Schedule");
- entity.HasIndex(e => new { e.Name, e.Path }, "IX_Schedule")
- .IsUnique();
- entity.Property(e => e.ScheduleId)
- .ValueGeneratedNever()
- .HasColumnName("ScheduleID");
- entity.Property(e => e.ConsistancyCheck).HasColumnType("datetime");
- entity.Property(e => e.EndDate).HasColumnType("datetime");
- entity.Property(e => e.EventData).HasMaxLength(260);
- entity.Property(e => e.EventType).HasMaxLength(260);
- entity.Property(e => e.LastRunStatus).HasMaxLength(260);
- entity.Property(e => e.LastRunTime).HasColumnType("datetime");
- entity.Property(e => e.Name).HasMaxLength(260);
- entity.Property(e => e.NextRunTime).HasColumnType("datetime");
- entity.Property(e => e.Path).HasMaxLength(260);
- entity.Property(e => e.StartDate).HasColumnType("datetime");
- entity.HasOne(d => d.CreatedBy)
- .WithMany(p => p.Schedules)
- .HasForeignKey(d => d.CreatedById)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("FK_Schedule_Users");
- });
- modelBuilder.Entity<SecDatum>(entity =>
- {
- entity.HasKey(e => e.SecDataId)
- .IsClustered(false);
- entity.HasIndex(e => new { e.PolicyId, e.AuthType }, "IX_SecData")
- .IsUnique()
- .IsClustered();
- entity.Property(e => e.SecDataId)
- .ValueGeneratedNever()
- .HasColumnName("SecDataID");
- entity.Property(e => e.NtSecDescPrimary).HasColumnType("image");
- entity.Property(e => e.NtSecDescSecondary).HasColumnType("ntext");
- entity.Property(e => e.PolicyId).HasColumnName("PolicyID");
- entity.Property(e => e.XmlDescription).HasColumnType("ntext");
- entity.HasOne(d => d.Policy)
- .WithMany(p => p.SecData)
- .HasForeignKey(d => d.PolicyId)
- .HasConstraintName("FK_SecDataPolicyID");
- });
- modelBuilder.Entity<Segment>(entity =>
- {
- entity.ToTable("Segment");
- entity.HasIndex(e => e.SegmentId, "IX_SegmentMetadata")
- .IsUnique();
- entity.Property(e => e.SegmentId).HasDefaultValueSql("(newsequentialid())");
- });
- modelBuilder.Entity<SegmentedChunk>(entity =>
- {
- entity.ToTable("SegmentedChunk");
- entity.HasIndex(e => new { e.ChunkId, e.SnapshotDataId }, "IX_ChunkId_SnapshotDataId");
- entity.HasIndex(e => new { e.SnapshotDataId, e.ChunkType, e.ChunkName }, "UNIQ_SnapshotChunkMapping")
- .IsUnique();
- entity.Property(e => e.ChunkId).HasDefaultValueSql("(newsequentialid())");
- entity.Property(e => e.ChunkName).HasMaxLength(260);
- entity.Property(e => e.MimeType).HasMaxLength(260);
- });
- modelBuilder.Entity<ServerParametersInstance>(entity =>
- {
- entity.HasKey(e => e.ServerParametersId);
- entity.ToTable("ServerParametersInstance");
- entity.HasIndex(e => e.Expiration, "IX_ServerParametersInstanceExpiration");
- entity.Property(e => e.ServerParametersId)
- .HasMaxLength(32)
- .HasColumnName("ServerParametersID");
- entity.Property(e => e.CreateDate).HasColumnType("datetime");
- entity.Property(e => e.Expiration).HasColumnType("datetime");
- entity.Property(e => e.ModifiedDate).HasColumnType("datetime");
- entity.Property(e => e.ParametersValues).HasColumnType("image");
- entity.Property(e => e.ParentId)
- .HasMaxLength(32)
- .HasColumnName("ParentID");
- entity.Property(e => e.Path).HasMaxLength(425);
- });
- modelBuilder.Entity<ServerUpgradeHistory>(entity =>
- {
- entity.HasKey(e => e.UpgradeId);
- entity.ToTable("ServerUpgradeHistory");
- entity.Property(e => e.UpgradeId).HasColumnName("UpgradeID");
- entity.Property(e => e.DateTime)
- .HasColumnType("datetime")
- .HasDefaultValueSql("(getdate())");
- entity.Property(e => e.ServerVersion).HasMaxLength(25);
- entity.Property(e => e.User)
- .HasMaxLength(128)
- .HasDefaultValueSql("(suser_sname())");
- });
- modelBuilder.Entity<SnapshotDatum>(entity =>
- {
- entity.HasKey(e => e.SnapshotDataId);
- entity.HasIndex(e => e.PermanentRefcount, "IX_SnapshotCleaning");
- entity.Property(e => e.SnapshotDataId)
- .ValueGeneratedNever()
- .HasColumnName("SnapshotDataID");
- entity.Property(e => e.CreatedDate).HasColumnType("datetime");
- entity.Property(e => e.Description).HasMaxLength(512);
- entity.Property(e => e.EffectiveParams).HasColumnType("ntext");
- entity.Property(e => e.ExpirationDate).HasColumnType("datetime");
- entity.Property(e => e.QueryParams).HasColumnType("ntext");
- });
- modelBuilder.Entity<Subscription>(entity =>
- {
- entity.Property(e => e.SubscriptionId)
- .ValueGeneratedNever()
- .HasColumnName("SubscriptionID");
- entity.Property(e => e.DataSettings).HasColumnType("ntext");
- entity.Property(e => e.DeliveryExtension).HasMaxLength(260);
- entity.Property(e => e.Description).HasMaxLength(512);
- entity.Property(e => e.EventType).HasMaxLength(260);
- entity.Property(e => e.ExtensionSettings).HasColumnType("ntext");
- entity.Property(e => e.LastRunTime).HasColumnType("datetime");
- entity.Property(e => e.LastStatus).HasMaxLength(260);
- entity.Property(e => e.Locale).HasMaxLength(128);
- entity.Property(e => e.MatchData).HasColumnType("ntext");
- entity.Property(e => e.ModifiedById).HasColumnName("ModifiedByID");
- entity.Property(e => e.ModifiedDate).HasColumnType("datetime");
- entity.Property(e => e.OwnerId).HasColumnName("OwnerID");
- entity.Property(e => e.Parameters).HasColumnType("ntext");
- entity.Property(e => e.ReportOid).HasColumnName("Report_OID");
- entity.HasOne(d => d.ModifiedBy)
- .WithMany(p => p.SubscriptionModifiedBies)
- .HasForeignKey(d => d.ModifiedById)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("FK_Subscriptions_ModifiedBy");
- entity.HasOne(d => d.Owner)
- .WithMany(p => p.SubscriptionOwners)
- .HasForeignKey(d => d.OwnerId)
- .OnDelete(DeleteBehavior.ClientSetNull)
- .HasConstraintName("FK_Subscriptions_Owner");
- entity.HasOne(d => d.ReportO)
- .WithMany(p => p.Subscriptions)
- .HasForeignKey(d => d.ReportOid)
- .HasConstraintName("FK_Subscriptions_Catalog");
- });
- modelBuilder.Entity<SubscriptionsBeingDeleted>(entity =>
- {
- entity.HasKey(e => e.SubscriptionId);
- entity.ToTable("SubscriptionsBeingDeleted");
- entity.Property(e => e.SubscriptionId)
- .ValueGeneratedNever()
- .HasColumnName("SubscriptionID");
- entity.Property(e => e.CreationDate).HasColumnType("datetime");
- });
- modelBuilder.Entity<UpgradeInfo>(entity =>
- {
- entity.HasKey(e => e.Item);
- entity.ToTable("UpgradeInfo");
- entity.Property(e => e.Item).HasMaxLength(260);
- entity.Property(e => e.Status).HasMaxLength(512);
- });
- modelBuilder.Entity<User>(entity =>
- {
- entity.HasKey(e => e.UserId)
- .IsClustered(false);
- entity.HasIndex(e => new { e.Sid, e.UserName, e.AuthType }, "IX_Users")
- .IsUnique()
- .IsClustered();
- entity.Property(e => e.UserId)
- .ValueGeneratedNever()
- .HasColumnName("UserID");
- entity.Property(e => e.Sid).HasMaxLength(85);
- entity.Property(e => e.UserName).HasMaxLength(260);
- });
- OnModelCreatingPartial(modelBuilder);
- }
- partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
- }
- }
|