English 中文(简体)
NHibernate地图
原标题:Mapping Tables with NHibernate

我是新到恩赫特的,因此我不敢肯定,我甚至会问问题。 但这里是这样。

This is my problem:

我正在利用Orchard CMS建立一个网站。 所有Orchard表格都由NHibernate绘制。 我也在同一数据库中设有由NHibernate绘制的地图。 这些表格由客户提供。 我需要询问这些表格,并使用Orchard在前端显示数据。 我必须保持表象不变。 我对如何利用国家自由绘制表格,无论我在教学中看到什么,都要求表格中有一个作为主要钥匙的识别栏。 客户向我提供的任何表格都没有将ID作为第一/主要栏。 能否在不使用国际发展法的情况下将这些表格绘制成地图? 或者身份识别方法的变更?

Id(x => x.Id);

相反,我可以用以下方法绘制表格:

MyColumnName/Primarykey(x => x.Id);

Id(x => x.MyColumnname/PrimaryKey);

此时此刻,我不能将数据移至新表格中,而表象也必须保持原样。 由于客户正在夜间更新这些表格。

感谢任何帮助。

增 编

最佳回答

you can specify different columnnames for properties and even different types if y

table Topic
(
  TopicCode int,
  BrochureDesc text,
  URL text,
  ...
  primary key(TopicCode)
)

public TopicMap()
{
    Id(x => x.Id, "TopicCode").GeneratedBy.Native();
    Map(x => x.BrochureDescription, "BrochureDesc");
    Map(x => x.URL);
    ...
}

Edit:

public TopicMap()
{
    CompositeId()
        .KeyProperty(x => x.Subtitle)
        .KeyProperty(x => x.Description)
        .KeyProperty(x => x.ImageURL);
}
问题回答

暂无回答




相关问题
Matrix to Represent a Triangle in Screen Space

So i have a set of four points in 3D Space. P1 [0, 0, 0] P2 [128, 0, 0] P3 [0, 128, 0] P4 [128, 128, 0] Which I m then projecting orthographically to the screen effectively giving me two ...

Using LINQ To SQL with multiple database tables

I have an employee class with as follows: public class Employee { public string FirstName { get; set; } public string LastName { get; set; } public string UserName { get; set; } ...

Mapping points from Euclician 2-space onto a Poincare disc

For some reason it seems that everyone writing webpages about Poincare discs is only concerned with how to represent lines and measure distances. I d like to morph a collection of 2D points (as ...

Fluent NHibernate, varbinary(max) and SQLite

I have a varbinary field in my sql server database that needs to be varbinary(max). I create my database with NHibernate and I use Fluent Nhibernate for my mappings. I also use SQLite for my unit ...

Javascript redirect

I am working with javascript and here is what I am trying to do: 1. Send a get request which looks like "http://localhost:8080/myapp/verify.htm?verifyId=Agkvhs" My requests reaches my verify.jsp in ...

热门标签