ReportServerContext.cs 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127
  1. using System;
  2. using System.Collections.Generic;
  3. using CodeFirstExistingDatabaseSample.ReportServer.Models;
  4. using Microsoft.EntityFrameworkCore;
  5. using Microsoft.EntityFrameworkCore.Metadata;
  6. namespace CodeFirstExistingDatabaseSample
  7. {
  8. public partial class ReportServerContext : DbContext
  9. {
  10. public ReportServerContext()
  11. {
  12. }
  13. public ReportServerContext(DbContextOptions<ReportServerContext> options)
  14. : base(options)
  15. {
  16. }
  17. public virtual DbSet<ActiveSubscription> ActiveSubscriptions { get; set; } = null!;
  18. public virtual DbSet<Batch> Batches { get; set; } = null!;
  19. public virtual DbSet<CachePolicy> CachePolicies { get; set; } = null!;
  20. public virtual DbSet<Catalog> Catalogs { get; set; } = null!;
  21. public virtual DbSet<ChunkDatum> ChunkData { get; set; } = null!;
  22. public virtual DbSet<ChunkSegmentMapping> ChunkSegmentMappings { get; set; } = null!;
  23. public virtual DbSet<ConfigurationInfo> ConfigurationInfos { get; set; } = null!;
  24. public virtual DbSet<DataSet> DataSets { get; set; } = null!;
  25. public virtual DbSet<DataSource> DataSources { get; set; } = null!;
  26. public virtual DbSet<DbupgradeHistory> DbupgradeHistories { get; set; } = null!;
  27. public virtual DbSet<Event> Events { get; set; } = null!;
  28. public virtual DbSet<ExecutionLog> ExecutionLogs { get; set; } = null!;
  29. public virtual DbSet<ExecutionLog2> ExecutionLog2s { get; set; } = null!;
  30. public virtual DbSet<ExecutionLog3> ExecutionLog3s { get; set; } = null!;
  31. public virtual DbSet<ExecutionLogStorage> ExecutionLogStorages { get; set; } = null!;
  32. public virtual DbSet<ExtendedDataSet> ExtendedDataSets { get; set; } = null!;
  33. public virtual DbSet<ExtendedDataSource> ExtendedDataSources { get; set; } = null!;
  34. public virtual DbSet<History> Histories { get; set; } = null!;
  35. public virtual DbSet<Key> Keys { get; set; } = null!;
  36. public virtual DbSet<ModelDrill> ModelDrills { get; set; } = null!;
  37. public virtual DbSet<ModelItemPolicy> ModelItemPolicies { get; set; } = null!;
  38. public virtual DbSet<ModelPerspective> ModelPerspectives { get; set; } = null!;
  39. public virtual DbSet<Notification> Notifications { get; set; } = null!;
  40. public virtual DbSet<Policy> Policies { get; set; } = null!;
  41. public virtual DbSet<PolicyUserRole> PolicyUserRoles { get; set; } = null!;
  42. public virtual DbSet<ReportSchedule> ReportSchedules { get; set; } = null!;
  43. public virtual DbSet<Role> Roles { get; set; } = null!;
  44. public virtual DbSet<RunningJob> RunningJobs { get; set; } = null!;
  45. public virtual DbSet<Schedule> Schedules { get; set; } = null!;
  46. public virtual DbSet<SecDatum> SecData { get; set; } = null!;
  47. public virtual DbSet<Segment> Segments { get; set; } = null!;
  48. public virtual DbSet<SegmentedChunk> SegmentedChunks { get; set; } = null!;
  49. public virtual DbSet<ServerParametersInstance> ServerParametersInstances { get; set; } = null!;
  50. public virtual DbSet<ServerUpgradeHistory> ServerUpgradeHistories { get; set; } = null!;
  51. public virtual DbSet<SnapshotDatum> SnapshotData { get; set; } = null!;
  52. public virtual DbSet<Subscription> Subscriptions { get; set; } = null!;
  53. public virtual DbSet<SubscriptionsBeingDeleted> SubscriptionsBeingDeleteds { get; set; } = null!;
  54. public virtual DbSet<UpgradeInfo> UpgradeInfos { get; set; } = null!;
  55. public virtual DbSet<User> Users { get; set; } = null!;
  56. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  57. {
  58. if (!optionsBuilder.IsConfigured)
  59. {
  60. optionsBuilder.UseSqlServer("Server=192.168.110.161;User ID=sa;Password=sa;Database=ReportServer;Trusted_Connection=False;");
  61. }
  62. }
  63. protected override void OnModelCreating(ModelBuilder modelBuilder)
  64. {
  65. modelBuilder.UseCollation("Latin1_General_CI_AS_KS_WS");
  66. modelBuilder.Entity<ActiveSubscription>(entity =>
  67. {
  68. entity.HasKey(e => e.ActiveId);
  69. entity.Property(e => e.ActiveId)
  70. .ValueGeneratedNever()
  71. .HasColumnName("ActiveID");
  72. entity.Property(e => e.SubscriptionId).HasColumnName("SubscriptionID");
  73. entity.HasOne(d => d.Subscription)
  74. .WithMany(p => p.ActiveSubscriptions)
  75. .HasForeignKey(d => d.SubscriptionId)
  76. .HasConstraintName("FK_ActiveSubscriptions_Subscriptions");
  77. });
  78. modelBuilder.Entity<Batch>(entity =>
  79. {
  80. entity.HasNoKey();
  81. entity.ToTable("Batch");
  82. entity.HasIndex(e => new { e.BatchId, e.AddedOn }, "IX_Batch")
  83. .IsClustered();
  84. entity.HasIndex(e => e.AddedOn, "IX_Batch_1");
  85. entity.Property(e => e.Action)
  86. .HasMaxLength(32)
  87. .IsUnicode(false);
  88. entity.Property(e => e.AddedOn).HasColumnType("datetime");
  89. entity.Property(e => e.BatchId).HasColumnName("BatchID");
  90. entity.Property(e => e.Content).HasColumnType("image");
  91. entity.Property(e => e.Item).HasMaxLength(425);
  92. entity.Property(e => e.Param).HasMaxLength(425);
  93. entity.Property(e => e.Parent).HasMaxLength(425);
  94. entity.Property(e => e.Properties).HasColumnType("ntext");
  95. });
  96. modelBuilder.Entity<CachePolicy>(entity =>
  97. {
  98. entity.HasKey(e => e.CachePolicyId)
  99. .IsClustered(false);
  100. entity.ToTable("CachePolicy");
  101. entity.HasIndex(e => e.ReportId, "IX_CachePolicyReportID")
  102. .IsUnique()
  103. .IsClustered();
  104. entity.Property(e => e.CachePolicyId)
  105. .ValueGeneratedNever()
  106. .HasColumnName("CachePolicyID");
  107. entity.Property(e => e.ReportId).HasColumnName("ReportID");
  108. entity.HasOne(d => d.Report)
  109. .WithOne(p => p.CachePolicy)
  110. .HasForeignKey<CachePolicy>(d => d.ReportId)
  111. .HasConstraintName("FK_CachePolicyReportID");
  112. });
  113. modelBuilder.Entity<Catalog>(entity =>
  114. {
  115. entity.HasKey(e => e.ItemId)
  116. .IsClustered(false);
  117. entity.ToTable("Catalog");
  118. entity.HasIndex(e => e.Path, "IX_Catalog")
  119. .IsUnique()
  120. .IsClustered();
  121. entity.HasIndex(e => new { e.Type, e.ComponentId }, "IX_ComponentLookup");
  122. entity.HasIndex(e => e.LinkSourceId, "IX_Link");
  123. entity.HasIndex(e => e.ParentId, "IX_Parent");
  124. entity.HasIndex(e => e.SnapshotDataId, "IX_SnapshotDataId");
  125. entity.Property(e => e.ItemId)
  126. .ValueGeneratedNever()
  127. .HasColumnName("ItemID");
  128. entity.Property(e => e.ComponentId).HasColumnName("ComponentID");
  129. entity.Property(e => e.Content).HasColumnType("image");
  130. entity.Property(e => e.CreatedById).HasColumnName("CreatedByID");
  131. entity.Property(e => e.CreationDate).HasColumnType("datetime");
  132. entity.Property(e => e.Description).HasMaxLength(512);
  133. entity.Property(e => e.ExecutionTime).HasColumnType("datetime");
  134. entity.Property(e => e.LinkSourceId).HasColumnName("LinkSourceID");
  135. entity.Property(e => e.MimeType).HasMaxLength(260);
  136. entity.Property(e => e.ModifiedById).HasColumnName("ModifiedByID");
  137. entity.Property(e => e.ModifiedDate).HasColumnType("datetime");
  138. entity.Property(e => e.Name).HasMaxLength(425);
  139. entity.Property(e => e.Parameter).HasColumnType("ntext");
  140. entity.Property(e => e.ParentId).HasColumnName("ParentID");
  141. entity.Property(e => e.Path).HasMaxLength(425);
  142. entity.Property(e => e.PolicyId).HasColumnName("PolicyID");
  143. entity.Property(e => e.Property).HasColumnType("ntext");
  144. entity.Property(e => e.SnapshotDataId).HasColumnName("SnapshotDataID");
  145. entity.Property(e => e.SubType).HasMaxLength(128);
  146. entity.HasOne(d => d.CreatedBy)
  147. .WithMany(p => p.CatalogCreatedBies)
  148. .HasForeignKey(d => d.CreatedById)
  149. .OnDelete(DeleteBehavior.ClientSetNull)
  150. .HasConstraintName("FK_Catalog_CreatedByID");
  151. entity.HasOne(d => d.LinkSource)
  152. .WithMany(p => p.InverseLinkSource)
  153. .HasForeignKey(d => d.LinkSourceId)
  154. .HasConstraintName("FK_Catalog_LinkSourceID");
  155. entity.HasOne(d => d.ModifiedBy)
  156. .WithMany(p => p.CatalogModifiedBies)
  157. .HasForeignKey(d => d.ModifiedById)
  158. .OnDelete(DeleteBehavior.ClientSetNull)
  159. .HasConstraintName("FK_Catalog_ModifiedByID");
  160. entity.HasOne(d => d.Parent)
  161. .WithMany(p => p.InverseParent)
  162. .HasForeignKey(d => d.ParentId)
  163. .HasConstraintName("FK_Catalog_ParentID");
  164. entity.HasOne(d => d.Policy)
  165. .WithMany(p => p.Catalogs)
  166. .HasForeignKey(d => d.PolicyId)
  167. .OnDelete(DeleteBehavior.ClientSetNull)
  168. .HasConstraintName("FK_Catalog_Policy");
  169. });
  170. modelBuilder.Entity<ChunkDatum>(entity =>
  171. {
  172. entity.HasKey(e => e.ChunkId)
  173. .IsClustered(false);
  174. entity.HasIndex(e => new { e.SnapshotDataId, e.ChunkType, e.ChunkName }, "IX_ChunkData")
  175. .IsUnique()
  176. .IsClustered();
  177. entity.Property(e => e.ChunkId)
  178. .ValueGeneratedNever()
  179. .HasColumnName("ChunkID");
  180. entity.Property(e => e.ChunkName).HasMaxLength(260);
  181. entity.Property(e => e.Content).HasColumnType("image");
  182. entity.Property(e => e.MimeType).HasMaxLength(260);
  183. entity.Property(e => e.SnapshotDataId).HasColumnName("SnapshotDataID");
  184. });
  185. modelBuilder.Entity<ChunkSegmentMapping>(entity =>
  186. {
  187. entity.HasKey(e => new { e.ChunkId, e.SegmentId });
  188. entity.ToTable("ChunkSegmentMapping");
  189. entity.HasIndex(e => e.SegmentId, "IX_ChunkSegmentMapping_SegmentId");
  190. entity.HasIndex(e => new { e.ChunkId, e.StartByte }, "UNIQ_ChunkId_StartByte")
  191. .IsUnique();
  192. });
  193. modelBuilder.Entity<ConfigurationInfo>(entity =>
  194. {
  195. entity.HasKey(e => e.ConfigInfoId)
  196. .IsClustered(false);
  197. entity.ToTable("ConfigurationInfo");
  198. entity.HasIndex(e => e.Name, "IX_ConfigurationInfo")
  199. .IsUnique()
  200. .IsClustered();
  201. entity.Property(e => e.ConfigInfoId)
  202. .ValueGeneratedNever()
  203. .HasColumnName("ConfigInfoID");
  204. entity.Property(e => e.Name).HasMaxLength(260);
  205. entity.Property(e => e.Value).HasColumnType("ntext");
  206. });
  207. modelBuilder.Entity<DataSet>(entity =>
  208. {
  209. entity.HasKey(e => e.Id)
  210. .HasName("PK_DataSet")
  211. .IsClustered(false);
  212. entity.HasIndex(e => e.LinkId, "IX_DataSetLinkID");
  213. entity.HasIndex(e => new { e.ItemId, e.Name }, "IX_DataSet_ItemID_Name")
  214. .IsClustered();
  215. entity.Property(e => e.Id)
  216. .ValueGeneratedNever()
  217. .HasColumnName("ID");
  218. entity.Property(e => e.ItemId).HasColumnName("ItemID");
  219. entity.Property(e => e.LinkId).HasColumnName("LinkID");
  220. entity.Property(e => e.Name).HasMaxLength(260);
  221. entity.HasOne(d => d.Item)
  222. .WithMany(p => p.DataSetItems)
  223. .HasForeignKey(d => d.ItemId)
  224. .OnDelete(DeleteBehavior.ClientSetNull)
  225. .HasConstraintName("FK_DataSetItemID");
  226. entity.HasOne(d => d.Link)
  227. .WithMany(p => p.DataSetLinks)
  228. .HasForeignKey(d => d.LinkId)
  229. .HasConstraintName("FK_DataSetLinkID");
  230. });
  231. modelBuilder.Entity<DataSource>(entity =>
  232. {
  233. entity.HasKey(e => e.Dsid);
  234. entity.ToTable("DataSource");
  235. entity.HasIndex(e => e.ItemId, "IX_DataSourceItemID");
  236. entity.HasIndex(e => e.SubscriptionId, "IX_DataSourceSubscriptionID");
  237. entity.Property(e => e.Dsid)
  238. .ValueGeneratedNever()
  239. .HasColumnName("DSID");
  240. entity.Property(e => e.ConnectionString).HasColumnType("image");
  241. entity.Property(e => e.Extension).HasMaxLength(260);
  242. entity.Property(e => e.ItemId).HasColumnName("ItemID");
  243. entity.Property(e => e.Name).HasMaxLength(260);
  244. entity.Property(e => e.OriginalConnectionString).HasColumnType("image");
  245. entity.Property(e => e.Password).HasColumnType("image");
  246. entity.Property(e => e.Prompt).HasColumnType("ntext");
  247. entity.Property(e => e.SubscriptionId).HasColumnName("SubscriptionID");
  248. entity.Property(e => e.UserName).HasColumnType("image");
  249. entity.HasOne(d => d.Item)
  250. .WithMany(p => p.DataSources)
  251. .HasForeignKey(d => d.ItemId)
  252. .HasConstraintName("FK_DataSourceItemID");
  253. });
  254. modelBuilder.Entity<DbupgradeHistory>(entity =>
  255. {
  256. entity.HasKey(e => e.UpgradeId);
  257. entity.ToTable("DBUpgradeHistory");
  258. entity.Property(e => e.UpgradeId).HasColumnName("UpgradeID");
  259. entity.Property(e => e.DateTime)
  260. .HasColumnType("datetime")
  261. .HasDefaultValueSql("(getdate())");
  262. entity.Property(e => e.DbVersion).HasMaxLength(25);
  263. entity.Property(e => e.User)
  264. .HasMaxLength(128)
  265. .HasDefaultValueSql("(suser_sname())");
  266. });
  267. modelBuilder.Entity<Event>(entity =>
  268. {
  269. entity.ToTable("Event");
  270. entity.HasIndex(e => e.ProcessStart, "IX_Event2");
  271. entity.HasIndex(e => e.TimeEntered, "IX_Event_TimeEntered");
  272. entity.Property(e => e.EventId)
  273. .ValueGeneratedNever()
  274. .HasColumnName("EventID");
  275. entity.Property(e => e.BatchId).HasColumnName("BatchID");
  276. entity.Property(e => e.EventData).HasMaxLength(260);
  277. entity.Property(e => e.EventType).HasMaxLength(260);
  278. entity.Property(e => e.ProcessHeartbeat).HasColumnType("datetime");
  279. entity.Property(e => e.ProcessStart).HasColumnType("datetime");
  280. entity.Property(e => e.TimeEntered).HasColumnType("datetime");
  281. });
  282. modelBuilder.Entity<ExecutionLog>(entity =>
  283. {
  284. entity.HasNoKey();
  285. entity.ToView("ExecutionLog");
  286. entity.Property(e => e.Format).HasMaxLength(26);
  287. entity.Property(e => e.InstanceName).HasMaxLength(38);
  288. entity.Property(e => e.Parameters).HasColumnType("ntext");
  289. entity.Property(e => e.ReportId).HasColumnName("ReportID");
  290. entity.Property(e => e.Status).HasMaxLength(40);
  291. entity.Property(e => e.TimeEnd).HasColumnType("datetime");
  292. entity.Property(e => e.TimeStart).HasColumnType("datetime");
  293. entity.Property(e => e.UserName).HasMaxLength(260);
  294. });
  295. modelBuilder.Entity<ExecutionLog2>(entity =>
  296. {
  297. entity.HasNoKey();
  298. entity.ToView("ExecutionLog2");
  299. entity.Property(e => e.AdditionalInfo).HasColumnType("xml");
  300. entity.Property(e => e.ExecutionId).HasMaxLength(64);
  301. entity.Property(e => e.Format).HasMaxLength(26);
  302. entity.Property(e => e.InstanceName).HasMaxLength(38);
  303. entity.Property(e => e.Parameters).HasColumnType("ntext");
  304. entity.Property(e => e.ReportAction)
  305. .HasMaxLength(21)
  306. .IsUnicode(false);
  307. entity.Property(e => e.ReportPath).HasMaxLength(425);
  308. entity.Property(e => e.RequestType)
  309. .HasMaxLength(12)
  310. .IsUnicode(false);
  311. entity.Property(e => e.Source)
  312. .HasMaxLength(8)
  313. .IsUnicode(false);
  314. entity.Property(e => e.Status).HasMaxLength(40);
  315. entity.Property(e => e.TimeEnd).HasColumnType("datetime");
  316. entity.Property(e => e.TimeStart).HasColumnType("datetime");
  317. entity.Property(e => e.UserName).HasMaxLength(260);
  318. });
  319. modelBuilder.Entity<ExecutionLog3>(entity =>
  320. {
  321. entity.HasNoKey();
  322. entity.ToView("ExecutionLog3");
  323. entity.Property(e => e.AdditionalInfo).HasColumnType("xml");
  324. entity.Property(e => e.ExecutionId).HasMaxLength(64);
  325. entity.Property(e => e.Format).HasMaxLength(26);
  326. entity.Property(e => e.InstanceName).HasMaxLength(38);
  327. entity.Property(e => e.ItemAction)
  328. .HasMaxLength(21)
  329. .IsUnicode(false);
  330. entity.Property(e => e.ItemPath).HasMaxLength(425);
  331. entity.Property(e => e.Parameters).HasColumnType("ntext");
  332. entity.Property(e => e.RequestType)
  333. .HasMaxLength(13)
  334. .IsUnicode(false);
  335. entity.Property(e => e.Source)
  336. .HasMaxLength(8)
  337. .IsUnicode(false);
  338. entity.Property(e => e.Status).HasMaxLength(40);
  339. entity.Property(e => e.TimeEnd).HasColumnType("datetime");
  340. entity.Property(e => e.TimeStart).HasColumnType("datetime");
  341. entity.Property(e => e.UserName).HasMaxLength(260);
  342. });
  343. modelBuilder.Entity<ExecutionLogStorage>(entity =>
  344. {
  345. entity.HasKey(e => e.LogEntryId)
  346. .HasName("PK__Executio__05F5D745E1B95E21");
  347. entity.ToTable("ExecutionLogStorage");
  348. entity.HasIndex(e => new { e.TimeStart, e.LogEntryId }, "IX_ExecutionLog");
  349. entity.Property(e => e.AdditionalInfo).HasColumnType("xml");
  350. entity.Property(e => e.ExecutionId).HasMaxLength(64);
  351. entity.Property(e => e.Format).HasMaxLength(26);
  352. entity.Property(e => e.InstanceName).HasMaxLength(38);
  353. entity.Property(e => e.Parameters).HasColumnType("ntext");
  354. entity.Property(e => e.ReportId).HasColumnName("ReportID");
  355. entity.Property(e => e.Status).HasMaxLength(40);
  356. entity.Property(e => e.TimeEnd).HasColumnType("datetime");
  357. entity.Property(e => e.TimeStart).HasColumnType("datetime");
  358. entity.Property(e => e.UserName).HasMaxLength(260);
  359. });
  360. modelBuilder.Entity<ExtendedDataSet>(entity =>
  361. {
  362. entity.HasNoKey();
  363. entity.ToView("ExtendedDataSets");
  364. entity.Property(e => e.Id).HasColumnName("ID");
  365. entity.Property(e => e.ItemId).HasColumnName("ItemID");
  366. entity.Property(e => e.LinkId).HasColumnName("LinkID");
  367. entity.Property(e => e.Name).HasMaxLength(260);
  368. });
  369. modelBuilder.Entity<ExtendedDataSource>(entity =>
  370. {
  371. entity.HasNoKey();
  372. entity.ToView("ExtendedDataSources");
  373. entity.Property(e => e.ConnectionString).HasColumnType("image");
  374. entity.Property(e => e.Dsid).HasColumnName("DSID");
  375. entity.Property(e => e.Extension).HasMaxLength(260);
  376. entity.Property(e => e.ItemId).HasColumnName("ItemID");
  377. entity.Property(e => e.Name).HasMaxLength(260);
  378. entity.Property(e => e.OriginalConnectionString).HasColumnType("image");
  379. entity.Property(e => e.Password).HasColumnType("image");
  380. entity.Property(e => e.Prompt).HasColumnType("ntext");
  381. entity.Property(e => e.SubscriptionId).HasColumnName("SubscriptionID");
  382. entity.Property(e => e.UserName).HasColumnType("image");
  383. });
  384. modelBuilder.Entity<History>(entity =>
  385. {
  386. entity.HasKey(e => e.HistoryId)
  387. .IsClustered(false);
  388. entity.ToTable("History");
  389. entity.HasIndex(e => new { e.ReportId, e.SnapshotDate }, "IX_History")
  390. .IsUnique()
  391. .IsClustered();
  392. entity.HasIndex(e => e.SnapshotDataId, "IX_SnapshotDataID");
  393. entity.Property(e => e.HistoryId)
  394. .ValueGeneratedNever()
  395. .HasColumnName("HistoryID");
  396. entity.Property(e => e.ReportId).HasColumnName("ReportID");
  397. entity.Property(e => e.SnapshotDataId).HasColumnName("SnapshotDataID");
  398. entity.Property(e => e.SnapshotDate).HasColumnType("datetime");
  399. });
  400. modelBuilder.Entity<Key>(entity =>
  401. {
  402. entity.HasKey(e => new { e.InstallationId, e.Client });
  403. entity.Property(e => e.InstallationId).HasColumnName("InstallationID");
  404. entity.Property(e => e.InstanceName).HasMaxLength(32);
  405. entity.Property(e => e.MachineName).HasMaxLength(256);
  406. entity.Property(e => e.PublicKey).HasColumnType("image");
  407. entity.Property(e => e.SymmetricKey).HasColumnType("image");
  408. });
  409. modelBuilder.Entity<ModelDrill>(entity =>
  410. {
  411. entity.HasKey(e => e.ModelDrillId)
  412. .IsClustered(false);
  413. entity.ToTable("ModelDrill");
  414. entity.HasIndex(e => new { e.ModelId, e.ReportId, e.ModelDrillId }, "IX_ModelDrillModelID")
  415. .IsUnique()
  416. .IsClustered();
  417. entity.Property(e => e.ModelDrillId)
  418. .ValueGeneratedNever()
  419. .HasColumnName("ModelDrillID");
  420. entity.Property(e => e.ModelId).HasColumnName("ModelID");
  421. entity.Property(e => e.ModelItemId)
  422. .HasMaxLength(425)
  423. .HasColumnName("ModelItemID");
  424. entity.Property(e => e.ReportId).HasColumnName("ReportID");
  425. entity.HasOne(d => d.Model)
  426. .WithMany(p => p.ModelDrillModels)
  427. .HasForeignKey(d => d.ModelId)
  428. .HasConstraintName("FK_ModelDrillModel");
  429. entity.HasOne(d => d.Report)
  430. .WithMany(p => p.ModelDrillReports)
  431. .HasForeignKey(d => d.ReportId)
  432. .OnDelete(DeleteBehavior.ClientSetNull)
  433. .HasConstraintName("FK_ModelDrillReport");
  434. });
  435. modelBuilder.Entity<ModelItemPolicy>(entity =>
  436. {
  437. entity.HasKey(e => e.Id)
  438. .IsClustered(false);
  439. entity.ToTable("ModelItemPolicy");
  440. entity.HasIndex(e => new { e.CatalogItemId, e.ModelItemId }, "IX_ModelItemPolicy")
  441. .IsClustered();
  442. entity.Property(e => e.Id)
  443. .ValueGeneratedNever()
  444. .HasColumnName("ID");
  445. entity.Property(e => e.CatalogItemId).HasColumnName("CatalogItemID");
  446. entity.Property(e => e.ModelItemId)
  447. .HasMaxLength(425)
  448. .HasColumnName("ModelItemID");
  449. entity.Property(e => e.PolicyId).HasColumnName("PolicyID");
  450. entity.HasOne(d => d.Policy)
  451. .WithMany(p => p.ModelItemPolicies)
  452. .HasForeignKey(d => d.PolicyId)
  453. .HasConstraintName("FK_PoliciesPolicyID");
  454. });
  455. modelBuilder.Entity<ModelPerspective>(entity =>
  456. {
  457. entity.HasNoKey();
  458. entity.ToTable("ModelPerspective");
  459. entity.HasIndex(e => e.ModelId, "IX_ModelPerspective")
  460. .IsClustered();
  461. entity.Property(e => e.Id).HasColumnName("ID");
  462. entity.Property(e => e.ModelId).HasColumnName("ModelID");
  463. entity.Property(e => e.PerspectiveDescription).HasColumnType("ntext");
  464. entity.Property(e => e.PerspectiveId)
  465. .HasColumnType("ntext")
  466. .HasColumnName("PerspectiveID");
  467. entity.Property(e => e.PerspectiveName).HasColumnType("ntext");
  468. entity.HasOne(d => d.Model)
  469. .WithMany()
  470. .HasForeignKey(d => d.ModelId)
  471. .HasConstraintName("FK_ModelPerspectiveModel");
  472. });
  473. modelBuilder.Entity<Notification>(entity =>
  474. {
  475. entity.HasIndex(e => e.ProcessAfter, "IX_Notifications");
  476. entity.HasIndex(e => e.ProcessStart, "IX_Notifications2");
  477. entity.HasIndex(e => e.NotificationEntered, "IX_Notifications3");
  478. entity.Property(e => e.NotificationId)
  479. .ValueGeneratedNever()
  480. .HasColumnName("NotificationID");
  481. entity.Property(e => e.ActivationId).HasColumnName("ActivationID");
  482. entity.Property(e => e.BatchId).HasColumnName("BatchID");
  483. entity.Property(e => e.DeliveryExtension).HasMaxLength(260);
  484. entity.Property(e => e.ExtensionSettings).HasColumnType("ntext");
  485. entity.Property(e => e.Locale).HasMaxLength(128);
  486. entity.Property(e => e.NotificationEntered).HasColumnType("datetime");
  487. entity.Property(e => e.Parameters).HasColumnType("ntext");
  488. entity.Property(e => e.ProcessAfter).HasColumnType("datetime");
  489. entity.Property(e => e.ProcessHeartbeat).HasColumnType("datetime");
  490. entity.Property(e => e.ProcessStart).HasColumnType("datetime");
  491. entity.Property(e => e.ReportId).HasColumnName("ReportID");
  492. entity.Property(e => e.SnapShotDate).HasColumnType("datetime");
  493. entity.Property(e => e.SubscriptionId).HasColumnName("SubscriptionID");
  494. entity.Property(e => e.SubscriptionLastRunTime).HasColumnType("datetime");
  495. entity.Property(e => e.SubscriptionOwnerId).HasColumnName("SubscriptionOwnerID");
  496. entity.HasOne(d => d.Subscription)
  497. .WithMany(p => p.Notifications)
  498. .HasForeignKey(d => d.SubscriptionId)
  499. .HasConstraintName("FK_Notifications_Subscriptions");
  500. });
  501. modelBuilder.Entity<Policy>(entity =>
  502. {
  503. entity.Property(e => e.PolicyId)
  504. .ValueGeneratedNever()
  505. .HasColumnName("PolicyID");
  506. });
  507. modelBuilder.Entity<PolicyUserRole>(entity =>
  508. {
  509. entity.HasKey(e => e.Id)
  510. .IsClustered(false);
  511. entity.ToTable("PolicyUserRole");
  512. entity.HasIndex(e => new { e.RoleId, e.UserId, e.PolicyId }, "IX_PolicyUserRole")
  513. .IsUnique()
  514. .IsClustered();
  515. entity.Property(e => e.Id)
  516. .ValueGeneratedNever()
  517. .HasColumnName("ID");
  518. entity.Property(e => e.PolicyId).HasColumnName("PolicyID");
  519. entity.Property(e => e.RoleId).HasColumnName("RoleID");
  520. entity.Property(e => e.UserId).HasColumnName("UserID");
  521. entity.HasOne(d => d.Policy)
  522. .WithMany(p => p.PolicyUserRoles)
  523. .HasForeignKey(d => d.PolicyId)
  524. .HasConstraintName("FK_PolicyUserRole_Policy");
  525. entity.HasOne(d => d.Role)
  526. .WithMany(p => p.PolicyUserRoles)
  527. .HasForeignKey(d => d.RoleId)
  528. .OnDelete(DeleteBehavior.ClientSetNull)
  529. .HasConstraintName("FK_PolicyUserRole_Role");
  530. entity.HasOne(d => d.User)
  531. .WithMany(p => p.PolicyUserRoles)
  532. .HasForeignKey(d => d.UserId)
  533. .OnDelete(DeleteBehavior.ClientSetNull)
  534. .HasConstraintName("FK_PolicyUserRole_User");
  535. });
  536. modelBuilder.Entity<ReportSchedule>(entity =>
  537. {
  538. entity.HasNoKey();
  539. entity.ToTable("ReportSchedule");
  540. entity.HasIndex(e => e.ReportId, "IX_ReportSchedule_ReportID");
  541. entity.HasIndex(e => e.ScheduleId, "IX_ReportSchedule_ScheduleID");
  542. entity.HasIndex(e => e.SubscriptionId, "IX_ReportSchedule_SubscriptionID");
  543. entity.Property(e => e.ReportId).HasColumnName("ReportID");
  544. entity.Property(e => e.ScheduleId).HasColumnName("ScheduleID");
  545. entity.Property(e => e.SubscriptionId).HasColumnName("SubscriptionID");
  546. entity.HasOne(d => d.Report)
  547. .WithMany()
  548. .HasForeignKey(d => d.ReportId)
  549. .HasConstraintName("FK_ReportSchedule_Report");
  550. entity.HasOne(d => d.Schedule)
  551. .WithMany()
  552. .HasForeignKey(d => d.ScheduleId)
  553. .HasConstraintName("FK_ReportSchedule_Schedule");
  554. entity.HasOne(d => d.Subscription)
  555. .WithMany()
  556. .HasForeignKey(d => d.SubscriptionId)
  557. .HasConstraintName("FK_ReportSchedule_Subscriptions");
  558. });
  559. modelBuilder.Entity<Role>(entity =>
  560. {
  561. entity.HasKey(e => e.RoleId)
  562. .IsClustered(false);
  563. entity.HasIndex(e => e.RoleName, "IX_Roles")
  564. .IsUnique()
  565. .IsClustered();
  566. entity.Property(e => e.RoleId)
  567. .ValueGeneratedNever()
  568. .HasColumnName("RoleID");
  569. entity.Property(e => e.Description).HasMaxLength(512);
  570. entity.Property(e => e.RoleName).HasMaxLength(260);
  571. entity.Property(e => e.TaskMask).HasMaxLength(32);
  572. });
  573. modelBuilder.Entity<RunningJob>(entity =>
  574. {
  575. entity.HasKey(e => e.JobId);
  576. entity.HasIndex(e => new { e.ComputerName, e.JobType }, "IX_RunningJobsStatus");
  577. entity.Property(e => e.JobId)
  578. .HasMaxLength(32)
  579. .HasColumnName("JobID");
  580. entity.Property(e => e.ComputerName).HasMaxLength(32);
  581. entity.Property(e => e.Description).HasColumnType("ntext");
  582. entity.Property(e => e.RequestName).HasMaxLength(425);
  583. entity.Property(e => e.RequestPath).HasMaxLength(425);
  584. entity.Property(e => e.StartDate).HasColumnType("datetime");
  585. });
  586. modelBuilder.Entity<Schedule>(entity =>
  587. {
  588. entity.ToTable("Schedule");
  589. entity.HasIndex(e => new { e.Name, e.Path }, "IX_Schedule")
  590. .IsUnique();
  591. entity.Property(e => e.ScheduleId)
  592. .ValueGeneratedNever()
  593. .HasColumnName("ScheduleID");
  594. entity.Property(e => e.ConsistancyCheck).HasColumnType("datetime");
  595. entity.Property(e => e.EndDate).HasColumnType("datetime");
  596. entity.Property(e => e.EventData).HasMaxLength(260);
  597. entity.Property(e => e.EventType).HasMaxLength(260);
  598. entity.Property(e => e.LastRunStatus).HasMaxLength(260);
  599. entity.Property(e => e.LastRunTime).HasColumnType("datetime");
  600. entity.Property(e => e.Name).HasMaxLength(260);
  601. entity.Property(e => e.NextRunTime).HasColumnType("datetime");
  602. entity.Property(e => e.Path).HasMaxLength(260);
  603. entity.Property(e => e.StartDate).HasColumnType("datetime");
  604. entity.HasOne(d => d.CreatedBy)
  605. .WithMany(p => p.Schedules)
  606. .HasForeignKey(d => d.CreatedById)
  607. .OnDelete(DeleteBehavior.ClientSetNull)
  608. .HasConstraintName("FK_Schedule_Users");
  609. });
  610. modelBuilder.Entity<SecDatum>(entity =>
  611. {
  612. entity.HasKey(e => e.SecDataId)
  613. .IsClustered(false);
  614. entity.HasIndex(e => new { e.PolicyId, e.AuthType }, "IX_SecData")
  615. .IsUnique()
  616. .IsClustered();
  617. entity.Property(e => e.SecDataId)
  618. .ValueGeneratedNever()
  619. .HasColumnName("SecDataID");
  620. entity.Property(e => e.NtSecDescPrimary).HasColumnType("image");
  621. entity.Property(e => e.NtSecDescSecondary).HasColumnType("ntext");
  622. entity.Property(e => e.PolicyId).HasColumnName("PolicyID");
  623. entity.Property(e => e.XmlDescription).HasColumnType("ntext");
  624. entity.HasOne(d => d.Policy)
  625. .WithMany(p => p.SecData)
  626. .HasForeignKey(d => d.PolicyId)
  627. .HasConstraintName("FK_SecDataPolicyID");
  628. });
  629. modelBuilder.Entity<Segment>(entity =>
  630. {
  631. entity.ToTable("Segment");
  632. entity.HasIndex(e => e.SegmentId, "IX_SegmentMetadata")
  633. .IsUnique();
  634. entity.Property(e => e.SegmentId).HasDefaultValueSql("(newsequentialid())");
  635. });
  636. modelBuilder.Entity<SegmentedChunk>(entity =>
  637. {
  638. entity.ToTable("SegmentedChunk");
  639. entity.HasIndex(e => new { e.ChunkId, e.SnapshotDataId }, "IX_ChunkId_SnapshotDataId");
  640. entity.HasIndex(e => new { e.SnapshotDataId, e.ChunkType, e.ChunkName }, "UNIQ_SnapshotChunkMapping")
  641. .IsUnique();
  642. entity.Property(e => e.ChunkId).HasDefaultValueSql("(newsequentialid())");
  643. entity.Property(e => e.ChunkName).HasMaxLength(260);
  644. entity.Property(e => e.MimeType).HasMaxLength(260);
  645. });
  646. modelBuilder.Entity<ServerParametersInstance>(entity =>
  647. {
  648. entity.HasKey(e => e.ServerParametersId);
  649. entity.ToTable("ServerParametersInstance");
  650. entity.HasIndex(e => e.Expiration, "IX_ServerParametersInstanceExpiration");
  651. entity.Property(e => e.ServerParametersId)
  652. .HasMaxLength(32)
  653. .HasColumnName("ServerParametersID");
  654. entity.Property(e => e.CreateDate).HasColumnType("datetime");
  655. entity.Property(e => e.Expiration).HasColumnType("datetime");
  656. entity.Property(e => e.ModifiedDate).HasColumnType("datetime");
  657. entity.Property(e => e.ParametersValues).HasColumnType("image");
  658. entity.Property(e => e.ParentId)
  659. .HasMaxLength(32)
  660. .HasColumnName("ParentID");
  661. entity.Property(e => e.Path).HasMaxLength(425);
  662. });
  663. modelBuilder.Entity<ServerUpgradeHistory>(entity =>
  664. {
  665. entity.HasKey(e => e.UpgradeId);
  666. entity.ToTable("ServerUpgradeHistory");
  667. entity.Property(e => e.UpgradeId).HasColumnName("UpgradeID");
  668. entity.Property(e => e.DateTime)
  669. .HasColumnType("datetime")
  670. .HasDefaultValueSql("(getdate())");
  671. entity.Property(e => e.ServerVersion).HasMaxLength(25);
  672. entity.Property(e => e.User)
  673. .HasMaxLength(128)
  674. .HasDefaultValueSql("(suser_sname())");
  675. });
  676. modelBuilder.Entity<SnapshotDatum>(entity =>
  677. {
  678. entity.HasKey(e => e.SnapshotDataId);
  679. entity.HasIndex(e => e.PermanentRefcount, "IX_SnapshotCleaning");
  680. entity.Property(e => e.SnapshotDataId)
  681. .ValueGeneratedNever()
  682. .HasColumnName("SnapshotDataID");
  683. entity.Property(e => e.CreatedDate).HasColumnType("datetime");
  684. entity.Property(e => e.Description).HasMaxLength(512);
  685. entity.Property(e => e.EffectiveParams).HasColumnType("ntext");
  686. entity.Property(e => e.ExpirationDate).HasColumnType("datetime");
  687. entity.Property(e => e.QueryParams).HasColumnType("ntext");
  688. });
  689. modelBuilder.Entity<Subscription>(entity =>
  690. {
  691. entity.Property(e => e.SubscriptionId)
  692. .ValueGeneratedNever()
  693. .HasColumnName("SubscriptionID");
  694. entity.Property(e => e.DataSettings).HasColumnType("ntext");
  695. entity.Property(e => e.DeliveryExtension).HasMaxLength(260);
  696. entity.Property(e => e.Description).HasMaxLength(512);
  697. entity.Property(e => e.EventType).HasMaxLength(260);
  698. entity.Property(e => e.ExtensionSettings).HasColumnType("ntext");
  699. entity.Property(e => e.LastRunTime).HasColumnType("datetime");
  700. entity.Property(e => e.LastStatus).HasMaxLength(260);
  701. entity.Property(e => e.Locale).HasMaxLength(128);
  702. entity.Property(e => e.MatchData).HasColumnType("ntext");
  703. entity.Property(e => e.ModifiedById).HasColumnName("ModifiedByID");
  704. entity.Property(e => e.ModifiedDate).HasColumnType("datetime");
  705. entity.Property(e => e.OwnerId).HasColumnName("OwnerID");
  706. entity.Property(e => e.Parameters).HasColumnType("ntext");
  707. entity.Property(e => e.ReportOid).HasColumnName("Report_OID");
  708. entity.HasOne(d => d.ModifiedBy)
  709. .WithMany(p => p.SubscriptionModifiedBies)
  710. .HasForeignKey(d => d.ModifiedById)
  711. .OnDelete(DeleteBehavior.ClientSetNull)
  712. .HasConstraintName("FK_Subscriptions_ModifiedBy");
  713. entity.HasOne(d => d.Owner)
  714. .WithMany(p => p.SubscriptionOwners)
  715. .HasForeignKey(d => d.OwnerId)
  716. .OnDelete(DeleteBehavior.ClientSetNull)
  717. .HasConstraintName("FK_Subscriptions_Owner");
  718. entity.HasOne(d => d.ReportO)
  719. .WithMany(p => p.Subscriptions)
  720. .HasForeignKey(d => d.ReportOid)
  721. .HasConstraintName("FK_Subscriptions_Catalog");
  722. });
  723. modelBuilder.Entity<SubscriptionsBeingDeleted>(entity =>
  724. {
  725. entity.HasKey(e => e.SubscriptionId);
  726. entity.ToTable("SubscriptionsBeingDeleted");
  727. entity.Property(e => e.SubscriptionId)
  728. .ValueGeneratedNever()
  729. .HasColumnName("SubscriptionID");
  730. entity.Property(e => e.CreationDate).HasColumnType("datetime");
  731. });
  732. modelBuilder.Entity<UpgradeInfo>(entity =>
  733. {
  734. entity.HasKey(e => e.Item);
  735. entity.ToTable("UpgradeInfo");
  736. entity.Property(e => e.Item).HasMaxLength(260);
  737. entity.Property(e => e.Status).HasMaxLength(512);
  738. });
  739. modelBuilder.Entity<User>(entity =>
  740. {
  741. entity.HasKey(e => e.UserId)
  742. .IsClustered(false);
  743. entity.HasIndex(e => new { e.Sid, e.UserName, e.AuthType }, "IX_Users")
  744. .IsUnique()
  745. .IsClustered();
  746. entity.Property(e => e.UserId)
  747. .ValueGeneratedNever()
  748. .HasColumnName("UserID");
  749. entity.Property(e => e.Sid).HasMaxLength(85);
  750. entity.Property(e => e.UserName).HasMaxLength(260);
  751. });
  752. OnModelCreatingPartial(modelBuilder);
  753. }
  754. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  755. }
  756. }