我正在使用nHibernate 2.1.2并重新强调nhibernate将在嵌套的多对一实体上生成左外连接.它似乎开始在第三个嵌套音符上生成left-outer-join,从实体组织开始.我在映射文件中设置了以下强制使用内连接,我在映射文件中错过了什么?真的希望有人能给我一个暗示.感谢任何帮助!
lazy="false" fetch="join"
Run Code Online (Sandbox Code Playgroud)
示例和关系: 销售记录 - 员工 - 组织
nhibernate生成:
select...
from sales
inner join employee
left outer join organization
Run Code Online (Sandbox Code Playgroud)
Sales.hbm.xml
<many-to-one name="Employee" insert="true" update="true" access="field.pascalcase-underscore" not-null="true" lazy="false" fetch="join"/>
<column name="EmployeeId" not-null="true"/>
</many-to-one>
Run Code Online (Sandbox Code Playgroud)
Employee.hbm.xml
<many-to-one name="Organization" insert="true" update="true" access="field.pascalcase-underscore" not-null="true" lazy="false" fetch="join"/>
<column name="OrgId" not-null="true"/>
</many-to-one>
Run Code Online (Sandbox Code Playgroud) 我正在使用VS2008 SP1,WCF Ria Service 2009年7月CTP.我发现MetadataType在部分类模式下不起作用,真的不知道我错过了什么:
工作:-
public partial class Person
{
private string _Name;
[Required(AllowEmptyStrings=false, ErrorMessage="Name required entry")]
[StringLength(3)]
public string Name
{
set{_Name = value;}
get{return _Name;}
}
}
class Program
{
static void Main(string[] args)
{
Person p = new Person { Name="123432" };
List res = new List();
Validator.TryValidateObject(p,new ValidationContext(p,null,null),
res,true);
if (res.Count > 0)
{
Console.WriteLine(res[0].ErrorMessage);
Console.ReadLine();
}
}
}
Run Code Online (Sandbox Code Playgroud)
不行
public partial class Person
{
private string _Name;
public string Name
{
set{_Name = value;} …Run Code Online (Sandbox Code Playgroud)