コード例 #1
0
        public void Test_EntityFrameworkMappings_GetObjects()
        => AssertInconclusiveHelper.WithConnectionInconclusiveAssertion(
            () =>
        {
            string connectionString = GetConnectionString_WithSpecialFormat();

            using (DbContext context = new TryEntityFrameworkContext(connectionString))
            {
                foreach (Thing thing in context.Set <Thing>())
                {
                    string name = thing.Name;
                }
            }
        });
コード例 #2
0
        public void Test_EntityFrameworkMappings_CreateObject()
        => AssertInconclusiveHelper.WithConnectionInconclusiveAssertion(
            () =>
        {
            string connectionString = GetConnectionString_WithSpecialFormat();

            using (DbContext context = new TryEntityFrameworkContext(connectionString))
            {
                var thing = new Thing {
                    Name = "Thing"
                };
                context.Set <Thing>().Add(thing);
                context.SaveChanges();
            }
        });