English 中文(简体)
关系中的儿童记录(EF4.0,POCO)
原标题:Child records from relation don t load (EF4.0, POCO)

我有2个班子:<>User和Booklink

        public class User
        {
            public int UserID { get; set; }
            public string Email { get; set; }
            public string Login { get; set; }
            public string Surname { get; set; }
            public string Name { get; set; }
            public int Points { get; set; }
            public string Password { get; set; }

            public IEnumerable<BookLink> BookLinks { get; set; }
        }

        public class BookLink
        {
            public int LinkID { get; set; }
            public int BookID { get; set; }
            public int UserID { get; set; }
            public DateTime EventDate { get; set; }

            public Book Book { get; set; }
            public User User { get; set; }

        }

我使用了新的EF4.0特征——POCO。

问题:当我装载用户<>/strong>实体图书链接财产NUL时(在图书链接表中有一些儿童记录)。 但是,其他领域(企业)被装上了罚款,所有这些领域(除了图书链接之外)都有数据库的价值。

我收到一般存放处的物体,如:

UsersRepository usersRepository = new UsersRepository();

            User user = usersRepository.FindByID(1);

FindByID方法与这种方法相同。

private ObjectSet<T> _entitySet;    
return _entitySet.AsQueryable().Where(predicate).SingeOrDefault();

网址:用户 例如:NULL

我可以理解,为什么我看着这个东西。 我如何能够自动装上儿童记录?

http://tinyurl.com/2ct45d5“rel=“nofollow noreferer”http://tinyurl.com/2ct45d5。 (如果这将有助于......)

问题回答

如果你宣布协会为virtual,则电荷装载可以停在POCO上。 (现为t)并促成代理创作(违约,国际仲裁裁决汇编)。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...