zoukankan      html  css  js  c++  java
  • NHibernate的陷井

          这几天公司准备用NHibernate作为基础框架,上网搜了搜,NHibernate官网提供了几个版本,最基础的是NHibernate,然后NHibernate.Burrow是对前者做了一些封装,NHibernate.Burrow.AppBlock则进一步进行了封装,看了下,确实很方便,于是自己动手写点玩意。

          帮助文档都是E文版,所有又好用又不要钱的玩意好像都是外国人搞出来的,好在还不难懂。官网下了个例子,结果中了一个招。请看帮助文档:

    Now consider a model of the relationships between Customer, Order and LineItem and Product. There is a one-to-many association between Customer and Order, but how should we represent Order / LineItem / Product? I've chosen to map LineItem as an association class representing the many-to-many association between Order and Product. In NHibernate, this is called a composite element.

    Code
          请看子表名:Order
    官网的例子有个Create_SQL的建表语句,如果你按照这个例子做下去,搞一对多的测试,会发现无论如何都会报错,
    嘿嘿,想到原因没?老夫我找了好久才搞明白,浪费了大量脑细胞啊。
          NHibernate中用代码工具生成的实体类必须要将XML映射文件选成嵌入的资源,才可以正常使用。
  • 相关阅读:
    c#去除List中的重复项
    c#比较两个List相等
    C#笔记
    解决Xcode真机测试时ineligible devices的问题
    unity3d UGUI多语言
    解决ugui中Image使用iTween的ColorTo、ColorFrom等不生效
    Unity3d uGUI适配
    184. 最大数
    187. 加油站
    46. 主元素
  • 原文地址:https://www.cnblogs.com/millen/p/1404786.html
Copyright © 2011-2022 走看看