1

I have a query about the Microsoft's Enterprise Library Data Access Application Block and NHibernate.

We are in the designing phase of our Software of Anti Money Laundering.

The Criteria is as below:

We have Customer Class which contains Account Class in One to Many relationship. The model is as follows: Customer 1->M Accounts

The Classes are defined like:

class Customer 
{ 
   private:
      int CustomerID;
      string CustomerName;
      List<string> Addresses;
      List<Account> accounts; 
} 

class Account 
{ 
   private:
      long AccountNumber;
      List<Transaction> transactions; 
      Customer customer;
} 

The Tables are defined like:

Table Customer
{
      int CustomerID;
      string CustomerName;
}

Table CustomerAddress
{
      int CustomerID;
      int Seqn;
      string Address;
}

Table Account 
{ 
      long AccountNumber;
      int CustomerID;
} 

We have decided to go for Designing our Data Access Layer either with MSEL or NHibernate. So Can you guide me that:

  1. What are the Pros & Cons of either of these Strategies?
  2. Should we Combine NHibernate with MSEL?
  3. Should we go for our own designed ORM based strategy with MSEL?
  4. Or some other Strategy from you technical Architect?

Please help me in this regard: which strategy is best? Or provide any other strategy. Please give your rationale as well.

4

1 回答 1

2

这是一个相当广泛的问题,没有多大意义,因为它将苹果与橙子进行比较,但我将尝试回答其中的一些问题:

  1. NHibernate 是一个 ORM,MSEL 是一组框架,这是两个最大的区别。NHibernate 只需要您创建一些 POCO 和 xml 文件来生成 DAL。在 MSEL 中使用数据应用程序块时,您必须输入 DAL 的所有代码或使用像Code Smith这样的第 3 方代码生成工具。

  2. 将它们结合起来是可能的,但对于数据应用程序块来说可能是不必要的,你应该只需要使用其中一个,NHib 允许你执行存储过程,所以如果有一些你不能在 c# 本身中做的事情,你可以始终将其移至 SP。至于 MSEL 中的其他块(加密、日志记录、异常等),您当然可以将它们与 NHibernate 一起使用。

  3. 设计你的 ORM 是一个非常糟糕的主意,除非你有一个庞大的团队可以正确地完成它,即使那样,如果你缺少一些功能,我也会修改现有的开源 ORM。

  4. 如果你负担得起, 我会选择 NHibernate 或llblgen 。

于 2009-02-14T08:46:03.503 回答