Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nhibernate模式导出_Nhibernate - Fatal编程技术网

Nhibernate模式导出

Nhibernate模式导出,nhibernate,Nhibernate,我在SQL Server中创建了一个数据库,我想使用C#中的Nhibernate导出模式。我有两个类叫做Customer和Address customer.cs: public class Customer { public int ID {get; set;} public Address Address1 { get; set; } public Address Address2 { get; set; } } public class Address {

我在SQL Server中创建了一个数据库,我想使用C#中的Nhibernate导出模式。我有两个类叫做
Customer
Address

customer.cs:

public class Customer
{
    public int ID {get; set;}

    public Address Address1 { get; set; }

    public Address Address2 { get; set; }
}
public class Address
{
    public string City{get;set;}

    public string Postcode{get;set;}
}
地址。cs:

public class Customer
{
    public int ID {get; set;}

    public Address Address1 { get; set; }

    public Address Address2 { get; set; }
}
public class Address
{
    public string City{get;set;}

    public string Postcode{get;set;}
}
我已经编写了
customer.hbm.xml
。我将地址定义为
组件

<component name="Address1" class="Address">
  <property name="City" />
  <property name="Postcode" />
</component>


当我的类是这样时,如何导出模式?

您可以使用
SchemaExport
class导出SQL模式

new SchemaExport(cfg).create(false, true);

我使用SchemeExport来完成这项工作。但是我没有将组件(地址)值作为字段来获取,因此映射文件存在问题。如果您也包含了映射文件,则可能会有所帮助。