コード例 #1
0
        [Fact] // CodePlex 1566
        public void Collection_instances_are_created_when_explicitly_loading_related_collections()
        {
            using (var context = new CollectionsContext())
            {
                context.Configuration.LazyLoadingEnabled = false;

                var entity = context.LotsOfCollections.Single();
                var entry  = context.Entry(entity);

                entry.Collection(e => e.AnICollection).Load();
                entry.Collection(e => e.AnIList).Load();
                entry.Collection(e => e.AnISet).Load();
                entry.Collection(e => e.AList).Load();
                entry.Collection(e => e.AHashSet).Load();
                entry.Collection(e => e.ACustomCollection).Load();
                entry.Collection(e => e.AGenericCustomCollection).Load();

                Assert.Equal(1, entity.AnICollection.Count);
                Assert.Equal(1, entity.AnIList.Count);
                Assert.Equal(1, entity.AnISet.Count);
                Assert.Equal(1, entity.AList.Count);
                Assert.Equal(1, entity.AHashSet.Count);
                Assert.Equal(1, entity.ACustomCollection.Count);
                Assert.Equal(1, entity.AGenericCustomCollection.Count);
            }
        }
コード例 #2
0
 [Fact] // CodePlex 1566
 public void Collection_instances_are_created_when_lazy_loading_related_collections()
 {
     using (var context = new CollectionsContext())
     {
         var entity = context.LotsOfCollections.Single();
         Assert.Equal(1, entity.AnICollection.Count);
         Assert.Equal(1, entity.AnIList.Count);
         Assert.Equal(1, entity.AnISet.Count);
         Assert.Equal(1, entity.AList.Count);
         Assert.Equal(1, entity.AHashSet.Count);
         Assert.Equal(1, entity.ACustomCollection.Count);
         Assert.Equal(1, entity.AGenericCustomCollection.Count);
     }
 }
コード例 #3
0
 public CollectionsController(CollectionsContext context)
 {
     _context = context;
 }
コード例 #4
0
 public static void SaveRecordCollection()
 {
     CollectionsContext.SaveCollectionMetadata(Collections.ToList());
 }