예제 #1
0
        public virtual DbSet Set([NotNull] Type entityType)
        {
            Check.NotNull(entityType, "entityType");

            // Note: Creating sets needs to be fast because it is done eagerly when a context instance
            // is created so we avoid loading metadata to validate the type here.
            return(_sets.GetSet(this, entityType));
        }
예제 #2
0
        public void Set_created_using_non_generic_method_is_cached_and_returned()
        {
            var context = Mock.Of<DbContext>();
            var sets = new ContextSets();

            var set = sets.GetSet(context, typeof(string));

            Assert.Same(set, sets.GetSet<string>(context));
        }
예제 #3
0
        public void Set_created_using_non_generic_method_is_cached_and_returned()
        {
            var context = Mock.Of <DbContext>();
            var sets    = new ContextSets();

            var set = sets.GetSet(context, typeof(string));

            Assert.Same(set, sets.GetSet <string>(context));
        }
예제 #4
0
        public void Non_generic_method_still_creates_new_generic_DbSet()
        {
            var context = Mock.Of<DbContext>();
            var sets = new ContextSets();

            var set = sets.GetSet(context, typeof(string));

            Assert.IsType<DbSet<string>>(set);
            Assert.Same(context.Configuration, set.Configuration);
        }
예제 #5
0
        public void Non_generic_method_still_creates_new_generic_DbSet()
        {
            var context = Mock.Of <DbContext>();
            var sets    = new ContextSets();

            var set = sets.GetSet(context, typeof(string));

            Assert.IsType <DbSet <string> >(set);
            Assert.Same(context.Configuration, set.Configuration);
        }