1. 程式人生 > >分享:Enterprise Library與ORM應用可以如此快捷

分享:Enterprise Library與ORM應用可以如此快捷

 主角不是Enterprise Library, 而是.NetTiers, 它是一個開源的ORM結合Enterprise Library的程式碼生成工具, 使用CodeSmith編寫, 自動生成ORM和單元測試程式碼, 小兵看完它的演示視訊後, 稱讚不而, CodeSmith可以如此強大, Enterprise Library應用可以如此快捷! 下面是它的一些介紹和資料, 有興趣的朋友可以看看.

The .Net data tiers generator

.NetTiers are CodeSmith templates for object-relational mapping that takes an existing SQLServer database and automatically generates a personnalized Data Tiers application block to use in your .Net applications.

Core features include:

  • Generates ready to use Visual Studio projects and solution.
  • Fully integrate with entreprise library application blocks architecture. Shipped with it's own plugin, so you can configure your application directly from the entlib configuration console.
  • Generate the business objects (called entities) with a 1:1 mapping ( an entity for each table, with a property for each column).
    • Serializable
    • trigger events
    • Implements an IEntity interface, which contains the columns that are present in every table
    • Specific support for enums.
  • Generate Data Access Layer Components (DALC) for tables and views , with following database operations :
    • Support for basic CRUD: UPDATE, DELETE, INSERT, SELECT ALL, PAGED SELECT, FIND
    • Support for queries using primary key
    • Support for queries using foreign key
    • Support for queries using keys that are part of an index
    • Support for queries using keys that are part of a junction table
    • Support for user defined Methods, generated from queries that are detected throught a very simple naming rule (_TableName_MyMethodName)
    • Support for Deep loading and saving, with children type selection and optional recursivity.
    • Support for find methods, with paging and sorting. (builded with the datagrid in mind :-)
    • NEW: Support for SqlView.
    • NEW: Select between stored procedure or xml embedded queries.
  • Generate strongly-typed collections for entities and repositories.
    • Implement CollectionBase , IBindingList, IList and ICloneable
    • Sortable, even Unsortable !
    • bindable to datagrid, or any winform or asp.net controls
  • it creates ASP.NET webservice for distributed programming.
  • Create the stored procedures script and can automatically install them on the server.
  • Generates a complete nAnt build file, to compile, test and generate chm/html API documentation.
  • A full set of nUnit tests.
  • Each object has a concrete and a base class which it inherit from. The concrete class is generated just once, so you have can use it to add you custom code.
  • the code is fully commented (it use to Description extended properties of the data table and column) and follow the microsoft naming guidelines.