Exemple #1
0
        public async Task Should_insert_shadow_properties()
        {
            var testEntity = new TestEntityWithShadowProperties {
                Id = new Guid("40B5CA93-5C02-48AD-B8A1-12BC13313866")
            };

            ActDbContext.Entry(testEntity).Property("ShadowStringProperty").CurrentValue = "value";
            ActDbContext.Entry(testEntity).Property("ShadowIntProperty").CurrentValue    = 42;

            var testEntities = new[] { testEntity };

            await SUT.BulkInsertAsync(testEntities, new SqliteBulkInsertOptions());

            var loadedEntity = await AssertDbContext.TestEntitiesWithShadowProperties.FirstOrDefaultAsync();

            AssertDbContext.Entry(loadedEntity).Property("ShadowStringProperty").CurrentValue.Should().Be("value");
            AssertDbContext.Entry(loadedEntity).Property("ShadowIntProperty").CurrentValue.Should().Be(42);
        }
Exemple #2
0
 public T Update(T entity)
 {
     AttachIfNot(entity);
     _dbContext.Entry(entity).State = EntityState.Modified;
     return(entity);
 }