映射返回null引用 [英] Mapping return null reference

查看:93
本文介绍了映射返回null引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助!!!

 

我有从学校班级到地址(1-1)班级的映射这个:

I have mapping from School class to Address (1-1) class like this:

             MapSingleType(s => new

            MapSingleType(s => new

        {

            {

           school_id = s.ID,

                school_id = s.ID,

          name = s.Name,

                name = s.Name,

          address = s.Address.ID,

                address = s.Address.ID,

       })。ToTable(" dbo.School");

            }).ToTable("dbo.School");

 

但是当我尝试解析学校实例(使用LINQ)时,Address属性为null,出了什么问题?

but when I try to resolve the school instance (with LINQ), the Address property is null, what is wrong ?

 

谢谢。


推荐答案

你好,

您是否设置了一对一关系?  如果没有,请参阅此相关主题,了解如何设置它,  http://social.msdn.microsoft.com/Forums/en-US/adonetefx/thread/89db5f94-818d-42e6-b0c4-908a88300ecd/ 。 

Have you set the one-to-one relationship?   If not, please refer to this related thread about how to set it, http://social.msdn.microsoft.com/Forums/en-US/adonetefx/thread/89db5f94-818d-42e6-b0c4-908a88300ecd/. 



最好的问候,b
Lingzhi Sun


Best Regards,
Lingzhi Sun


这篇关于映射返回null引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆