示例#1
0
        public CityMethodConfigureTests()
        {
            var citizensConfiguration = new CitiesConfiguration();

            _entityTypeBuilder = ModelBuilder.Entity <City>();
            citizensConfiguration.Configure(_entityTypeBuilder);
        }
        public ConfigurationBaseTest()
        {
            // Construct the optionsBuilder using InMemory SqlLite
            var options = new DbContextOptionsBuilder <RepositoryContext>()
                          .UseSqlite(new SqliteConnection("DataSource=:memory:"))
                          .Options;

            var usersConfiguration    = new UsersConfiguration();
            var citizensConfiguration = new CitizensConfiguration();
            var citiesConfiguration   = new CitiesConfiguration();
            var statesConfiguration   = new StatesConfiguration();

            var sut = new RepositoryContext(options, usersConfiguration, citizensConfiguration, citiesConfiguration, statesConfiguration);

            // Get the convention set for this db
            var conventionSet = ConventionSet.CreateConventionSet(sut);

            // Now create the ModelBuilder
            ModelBuilder = new ModelBuilder(conventionSet);
        }