/// <summary> /// Create a new Entity3 object. /// </summary> /// <param name="id">Initial value of Id.</param> public static Entity3 CreateEntity3(int id) { Entity3 entity3 = new Entity3(); entity3.Id = id; return(entity3); }
public async Task SelectAbstractClassDescendantsAsyncTest() { Require.AllFeaturesSupported(ProviderFeatures.Multischema); InitializeSchemas(); BuildDomain(DefaultSchema, DomainUpgradeMode.Recreate, typeof(Entity3)).Dispose(); var domain = BuildDomain(DefaultSchema, DomainUpgradeMode.PerformSafely, typeof(Entity3), typeof(Entity4)); using (domain) using (var session = domain.OpenSession()) using (var transaction = session.OpenTransaction()) { for (var i = 0; i < 10; i++) { _ = new Entity3 { Name = "1 before test " + i, StringValue = "1 before test " + i }; _ = new Entity4 { Name = "1 before test " + i, IntValue = i }; } transaction.Complete(); } BuildDomain(AlternativeSchema, DomainUpgradeMode.Recreate, typeof(Entity4)).Dispose(); domain = BuildDomain(AlternativeSchema, DomainUpgradeMode.PerformSafely, typeof(Entity4), typeof(Entity3)); using (domain) using (var session = domain.OpenSession()) using (var transaction = session.OpenTransaction()) { for (var i = 0; i < 10; i++) { _ = new Entity3 { Name = "2 before test " + i, StringValue = "1 before test " + i }; _ = new Entity4 { Name = "2 before test " + i, IntValue = i }; } transaction.Complete(); } domain = await BuildDomainAsync(DefaultSchema, DomainUpgradeMode.Validate, typeof(Entity3), typeof(Entity4)); await using (domain) { var nodeConfiguration = new NodeConfiguration(AlternativeSchema) { UpgradeMode = DomainUpgradeMode.Validate }; nodeConfiguration.SchemaMapping.Add(DefaultSchema, AlternativeSchema); _ = await domain.StorageNodeManager.AddNodeAsync(nodeConfiguration); RunTest(domain, WellKnown.DefaultNodeId, AbstractClassDescendantsTestBody); RunTest(domain, AlternativeSchema, AbstractClassDescendantsTestBody); } }
public void Test02() { using (var session = Domain.OpenSession()) using (var tx = session.OpenTransaction()) { _ = new Entity3(); _ = new Entity4(); } }
/// <summary> /// Create a new Entity3 object. /// </summary> /// <param name="id">Initial value of Id.</param> public static Entity3 CreateEntity3(int id) { Entity3 entity3 = new Entity3(); entity3.Id = id; return entity3; }
/// <summary> /// There are no comments for Entity3Set in the schema. /// </summary> public void AddToEntity3Set(Entity3 entity3) { base.AddObject("Entity3Set", entity3); }
public Entity1(Entity3 entity3) { Entity3 = entity3; }
static void Main(string[] args) { MCSContainer db = new MCSContainer(); //Ниже укажите путь , полный при чем StreamReader r = new StreamReader(@"C:\Users\user\Documents\Visual Studio 2017\Projects\ADO.NET_EntityFramework_01_HW\ModeFirstApp\TxtFile\AboutEgor.txt", Encoding.Default); string text = r.ReadToEnd(); Console.WriteLine("Подождите минуту. Выполняется важная операция..."); int k = 0; start: try { List <Entity1> ls = new List <Entity1>(); List <Entity2> ls2 = new List <Entity2>(); List <Entity3> ls3 = new List <Entity3>(); for (int i = 0; i < 2000; i++) { Entity1 s = new Entity1(); s.Name = "You Know Who is The Best_(" + i + ")_using_Entity1_table"; s.Desc = text; Entity3 s3 = new Entity3(); s3.Name = "You Know Who is The Best_(" + i + ")_using_Entity3_table"; s3.Desc = text; Entity2 s2 = new Entity2(); s2.Name = "You Know Who is The Best_(" + i + ")_using_Entity2_table"; s2.Desc = text; ls2.Add(s2); ls.Add(s); ls3.Add(s3); } foreach (Entity1 e in ls) { db.Entity1Set.Add(e); db.SaveChanges(); } foreach (Entity2 e in ls2) { db.Entity2Set.Add(e); db.SaveChanges(); } foreach (Entity3 e in ls3) { db.Entity3Set.Add(e); db.SaveChanges(); } k++; Console.WriteLine("База заполнена данными отлично!"); } catch (Exception ex) { if (k == 5) { Console.WriteLine("База заполнена данными отлично!"); } else { k++; goto start; } } }