예제 #1
0
        public void Members_check_arguments()
        {
            var finder = new DbSetFinder();

            Assert.Equal(
                "context",
                // ReSharper disable once AssignNullToNotNullAttribute
                Assert.Throws <ArgumentNullException>(() => finder.FindSets(null)).ParamName);
        }
예제 #2
0
            private IModel CreateModel(DbContext context, IModelBuilderFactory modelBuilderFactory)
            {
                var model        = new Model();
                var modelBuilder = modelBuilderFactory.CreateConventionBuilder(model);

                foreach (var setInfo in _setFinder.FindSets(context))
                {
                    modelBuilder.Entity(setInfo.EntityType);
                }

                ModelSourceHelpers.OnModelCreating(context, modelBuilder);

                model["AllYourModelAreBelongTo"] = "Us!";

                return(model);
            }
예제 #3
0
        public IModel GetModel(DbContext context, IModelBuilderFactory modelBuilderFactory)
        {
            var model        = new Model();
            var modelBuilder = modelBuilderFactory.CreateConventionBuilder(model);

            foreach (var setInfo in _setFinder.FindSets(context))
            {
                modelBuilder.Entity(setInfo.EntityType);
            }

            if (_onModelCreating == null)
            {
                ModelSourceHelpers.OnModelCreating(context, modelBuilder);
            }
            else
            {
                _onModelCreating(modelBuilder);
            }

            return(model);
        }