Пример #1
0
        public void CheckIfExceptionThrownOnNullEntityType()
        {
            DbContextBuilder contextBuilder = new DbContextBuilder();

            Assert.Throws <ArgumentNullException>(() =>
            {
                contextBuilder.WithEntity(null);
            });
        }
Пример #2
0
        public void CheckIfExceptionThrownOnNonClassEntityType()
        {
            DbContextBuilder contextBuilder = new DbContextBuilder();

            Assert.Throws <ArgumentException>(() =>
            {
                contextBuilder.WithEntity(typeof(int));
            });
        }
        public static DbContextBuilder WithRestModels(this DbContextBuilder contextBuilder, Assembly assembly)
        {
            IEnumerable <Type> assemblyRestModelTypes = assembly.GetRestModelTypes();

            foreach (Type restModelType in assemblyRestModelTypes)
            {
                contextBuilder.WithEntity(restModelType);
            }

            return(contextBuilder);
        }