コード例 #1
0
        public void Discover_returns_configuration()
        {
            var modelBuilder = new DbModelBuilder();
            modelBuilder.Entity<Entity>().Property(e => e.DateCreated).HasPrecision(2);
            var model = modelBuilder.Build(new DbProviderInfo("System.Data.SqlClient", "2012"));
            var entityType = model.ConceptualModel.EntityTypes.First();
            var property = entityType.Properties.First(p => p.Name == "DateCreated");

            var configuration = new PrecisionDateTimeDiscoverer()
                .Discover(property, model) as PrecisionDateTimeConfiguration;

            Assert.NotNull(configuration);
            Assert.Equal(2, configuration.Precision);
        }
コード例 #2
0
        public void Discover_returns_configuration()
        {
            var modelBuilder = new DbModelBuilder();

            modelBuilder.Entity <Entity>().Property(e => e.DateCreated).HasPrecision(2);
            var model      = modelBuilder.Build(new DbProviderInfo("System.Data.SqlClient", "2012"));
            var entityType = model.ConceptualModel.EntityTypes.First();
            var property   = entityType.Properties.First(p => p.Name == "DateCreated");

            var configuration = new PrecisionDateTimeDiscoverer()
                                .Discover(property, model) as PrecisionDateTimeConfiguration;

            Assert.NotNull(configuration);
            Assert.Equal(2, configuration.Precision);
        }