like me, many may look for a tool that can directly design business entities and generate persistence layers based on the design, just like hibernate tools. of course, many people may have different opinions on generating Code through tools, but there is such a tool, it will undoubtedly bring convenience to our development, especially an open-source tool that can meet our different needs based on modifications.
of course, codesmith and mygeneration are the first code generation tools in this regard. They can directly support templates and easily modify custom template files. I have also been in touch with latticeframework (http://www.latticesoft.com/), which was developed by a foreign student. generate an xeml file (in XML format) based on the database table and index information, and parse it into the generated code through XSLT.
however, the only disadvantage of these tools is that they do not support visual design of ORM business classes, nor can they easily prepare ing relationships between entities. in addition, these tools are based on databases rather than business objects. However, in many cases, there is a big difference between business objects and databases.
activewriter supports visual development and is integrated into vs as a plug-in. net, you can set all items. activewriter:
Activewriter is an open-source project under castle. It is directly integrated in vs.net and can be directly designed for entity visualization. It supports generating activerecord code and nhib.pdf entity code and. HBM. XML ing file. C # and VB.. net.
I.Download and install
Latest Version:Preview 4.1 (26/06/2008)
Vs 2008:Activewriter preview 4.1 For vs2008.rar (277.22 KB)
VS 2005:Activewriter preview 4 for vs2005.rar (1.43 MB) (the author of this open-source project has stopped this project from updating version 2005)
Source code:Https://svn.castleproject.org/svn/castlecontrib/activewriter/
After the source code is downloaded using the svn tool, you must install the Microsoft Visual Studio 2008 or 2005 SDK to compile it. the code is DSL tools. Recently, someone has been studying vs.net plug-in development. This should be called. A typical open source project developed by the. NET plug-in.
After the download is complete, install it directly without special settings.
2. usage and function introduction
after the installation is complete, activewriter can be used. However, activewriter does not create a new project, we only need to create a common project, and then add the activewrite file, you can design it in this file. first, let's introduce its Workspace (the author's demo ).
1. main design interface
here we can design our business entities, they can be directly dragged in from 6 or dragged in from 5 to completely redesign. right-click an object or attribute in the window to verify the validity, delete, edit, and add it.
2. project file
This is a common project, but activewriter file storage class design information (actiw, actiw. digoal). When the class design is complete, right-click the actiw file and select Run customer tool to generate the Code. The Code is generated. in the CS file, if the generated nhib.pdf, there will be another one. HBM. XML file.
3. Properties window
You can edit the properties of the selected item. this includes model generation settings, single object settings, object attribute settings, and link settings. After editing, all the settings will be completely generated into the class or ing file. In short, this is to convert the previously hand-written code or ing file operations into operations directly completed in the attribute settings window. it covers most of the settings of activerecord (nhib.pdf. let's take a look at the object setting window.
as you can see, you can set attributes such as cache, lazy, schema, table, and where, and many of them can be directly selected from the drop-down menu or set window opening, very powerful.
4.Class Details window
All the properties of the selected object are listed here. You can edit the type of this property and the fields corresponding to the database, and add new properties.
5. activewriter Toolbar
Here, the class and one-to-one relationship are included. you can drag multiple-to-one relationships, multiple-to-multiple relationships, embedded classes, and embedded relationships to workspace 1, select and then select the source and target in the workspace.
6. Resource browsing
The resources of the current database are listed here. You can drag the table directly to workspace 1 to generate corresponding objects. Currently, SQL Server, MySQL, and Oracle are supported.
Note before code generation:
1. Add the corresponding nhibcord and activerecord to the created ProjectProgramIn addition, the nhib.pdf version corresponding to the latest version is 1.2.0.4000, The activerecord version is 0.0.1.3, and the reference of the dependent assembly is added.
2. Right-click the blank area in the workspace and set the integration folder of nhib.pdf and activerecord in the Properties window.
The object attributes, object and attribute settings, and relationships between objects are automatically generated in the workspace.
3. due to activewriter's support for the Chinese version of Vs, the default "install new" template is under common7 "ide" itemtemplates "CSHARP" 1033, but the Chinese version of vs template is under 2052 by default, therefore, you need to manually convert it. You can also copy it to 2052 first, and then select the class relationship diagram when creating the item. suffix from. change CD to actiw.
Iii. Materials and references
1. activewriter official http://altinoren.com/activewriter/
2. activewriter developer's blog http://altinoren.com/default.aspx
3. dsl'sArticleHttp://www.cnblogs.com/yimlin/archive/2006/07/08/445673.html
4. About vs. Net DSL tools website http://www.domainspecificdevelopment.com/
5. Microsoft profile on DSL tools
Http://msdn.microsoft.com/en-us/vsx/cc677256.aspx
Http://msdn.microsoft.com/en-us/vsx/default.aspx
Http://msdn.microsoft.com/en-us/library/bb126235.aspx
From: http://www.cnblogs.com/lonely7345/archive/2009/03/17/1414764.html