This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
406 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
110 changes: 110 additions & 0 deletions
110
src/Testing/Sandbox/Sandbox_EFCore/AppDbContext.generated.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated from a template. | ||
// | ||
// Manual changes to this file may cause unexpected behavior in your application. | ||
// Manual changes to this file will be overwritten if the code is regenerated. | ||
// | ||
// Produced by Entity Framework Visual Editor v3.0.7.1 | ||
// Source: https://github.com/msawczyn/EFDesigner | ||
// Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=michaelsawczyn.EFDesigner | ||
// Documentation: https://msawczyn.github.io/EFDesigner/ | ||
// License (MIT): https://github.com/msawczyn/EFDesigner/blob/master/LICENSE | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace SureImpact.Data.Framework | ||
{ | ||
/// <inheritdoc/> | ||
public partial class AppDbContext : DbContext | ||
{ | ||
#region DbSets | ||
public virtual Microsoft.EntityFrameworkCore.DbSet<global::SureImpact.Data.Framework.TestData> TestDatas { get; set; } | ||
public virtual Microsoft.EntityFrameworkCore.DbSet<global::SureImpact.Data.Framework.TestView> TestViews { get; set; } | ||
|
||
#endregion DbSets | ||
|
||
/// <summary> | ||
/// Default connection string | ||
/// </summary> | ||
public static string ConnectionString { get; set; } = @"Data Source=.\sqlexpress;Initial Catalog=Test;Integrated Security=True"; | ||
|
||
/// <summary> | ||
/// <para> | ||
/// Initializes a new instance of the <see cref="T:Microsoft.EntityFrameworkCore.DbContext" /> class using the specified options. | ||
/// The <see cref="M:Microsoft.EntityFrameworkCore.DbContext.OnConfiguring(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder)" /> method will still be called to allow further | ||
/// configuration of the options. | ||
/// </para> | ||
/// </summary> | ||
/// <param name="options">The options for this context.</param> | ||
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) | ||
{ | ||
} | ||
|
||
partial void CustomInit(DbContextOptionsBuilder optionsBuilder); | ||
|
||
/// <inheritdoc /> | ||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
{ | ||
optionsBuilder.UseLazyLoadingProxies(); | ||
|
||
CustomInit(optionsBuilder); | ||
} | ||
|
||
partial void OnModelCreatingImpl(ModelBuilder modelBuilder); | ||
partial void OnModelCreatedImpl(ModelBuilder modelBuilder); | ||
|
||
/// <summary> | ||
/// Override this method to further configure the model that was discovered by convention from the entity types | ||
/// exposed in <see cref="T:Microsoft.EntityFrameworkCore.DbSet`1" /> properties on your derived context. The resulting model may be cached | ||
/// and re-used for subsequent instances of your derived context. | ||
/// </summary> | ||
/// <remarks> | ||
/// If a model is explicitly set on the options for this context (via <see cref="M:Microsoft.EntityFrameworkCore.DbContextOptionsBuilder.UseModel(Microsoft.EntityFrameworkCore.Metadata.IModel)" />) | ||
/// then this method will not be run. | ||
/// </remarks> | ||
/// <param name="modelBuilder"> | ||
/// The builder being used to construct the model for this context. Databases (and other extensions) typically | ||
/// define extension methods on this object that allow you to configure aspects of the model that are specific | ||
/// to a given database. | ||
/// </param> | ||
protected override void OnModelCreating(ModelBuilder modelBuilder) | ||
{ | ||
base.OnModelCreating(modelBuilder); | ||
OnModelCreatingImpl(modelBuilder); | ||
|
||
modelBuilder.HasDefaultSchema("dbo"); | ||
|
||
modelBuilder.Entity<global::SureImpact.Data.Framework.TestData>() | ||
.ToTable("TestDatas") | ||
.HasKey(t => t.Id); | ||
modelBuilder.Entity<global::SureImpact.Data.Framework.TestData>() | ||
.Property(t => t.TestString) | ||
.HasMaxLength(200) | ||
.IsRequired(); | ||
modelBuilder.Entity<global::SureImpact.Data.Framework.TestData>().HasIndex(t => t.TestString) | ||
.IsUnique(); | ||
modelBuilder.Entity<global::SureImpact.Data.Framework.TestData>() | ||
.Property(t => t.Id) | ||
.ValueGeneratedOnAdd() | ||
.IsRequired(); | ||
|
||
modelBuilder.Entity<global::SureImpact.Data.Framework.TestView>() | ||
.ToTable("TestViews"); | ||
modelBuilder.Entity<global::SureImpact.Data.Framework.TestView>() | ||
.Property(t => t.TestString) | ||
.HasMaxLength(200) | ||
.IsRequired(); | ||
modelBuilder.Entity<global::SureImpact.Data.Framework.TestView>().HasIndex(t => t.TestString) | ||
.IsUnique(); | ||
|
||
OnModelCreatedImpl(modelBuilder); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated from a template. | ||
// | ||
// Manual changes to this file may cause unexpected behavior in your application. | ||
// Manual changes to this file will be overwritten if the code is regenerated. | ||
// | ||
// Produced by Entity Framework Visual Editor v3.0.7.1 | ||
// Source: https://github.com/msawczyn/EFDesigner | ||
// Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=michaelsawczyn.EFDesigner | ||
// Documentation: https://msawczyn.github.io/EFDesigner/ | ||
// License (MIT): https://github.com/msawczyn/EFDesigner/blob/master/LICENSE | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.ComponentModel; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace SureImpact.Data.Framework | ||
{ | ||
public partial class TestData | ||
{ | ||
partial void Init(); | ||
|
||
/// <summary> | ||
/// Default constructor. Protected due to required properties, but present because EF needs it. | ||
/// </summary> | ||
protected TestData() | ||
{ | ||
Init(); | ||
} | ||
|
||
/// <summary> | ||
/// Replaces default constructor, since it's protected. Caller assumes responsibility for setting all required values before saving. | ||
/// </summary> | ||
public static TestData CreateTestDataUnsafe() | ||
{ | ||
return new TestData(); | ||
} | ||
|
||
/// <summary> | ||
/// Public constructor with required data | ||
/// </summary> | ||
/// <param name="teststring">Test string</param> | ||
public TestData(string teststring) | ||
{ | ||
if (string.IsNullOrEmpty(teststring)) throw new ArgumentNullException(nameof(teststring)); | ||
this.TestString = teststring; | ||
|
||
Init(); | ||
} | ||
|
||
/// <summary> | ||
/// Static create function (for use in LINQ queries, etc.) | ||
/// </summary> | ||
/// <param name="teststring">Test string</param> | ||
public static TestData Create(string teststring) | ||
{ | ||
return new TestData(teststring); | ||
} | ||
|
||
/************************************************************************* | ||
* Properties | ||
*************************************************************************/ | ||
|
||
/// <summary> | ||
/// Indexed, Required, Max length = 200 | ||
/// Test string | ||
/// </summary> | ||
[Required] | ||
[MaxLength(200)] | ||
[StringLength(200)] | ||
[System.ComponentModel.Description("Test string")] | ||
public string TestString { get; set; } | ||
|
||
/// <summary> | ||
/// Identity, Indexed, Required | ||
/// Unique identifier | ||
/// </summary> | ||
[Key] | ||
[Required] | ||
[System.ComponentModel.Description("Unique identifier")] | ||
public long Id { get; set; } | ||
|
||
} | ||
} | ||
|
Oops, something went wrong.