This page will guide you through the SnCore data development process. It's really easy and powerful.
- Microsoft SQL Server 2000
- Puzzle Framework (ObjectMapper)
This is where everything starts. Think object oriented approach at a 100 percent. To create a new concept you must first create a new table. This is typically done in Enterprise Manager. There're a few rules of thumb.
-
There must be an automatic Id to every table with a primary key.
-
Unique keys are named UK_.
-
Foreign keys cascade delete in 99 percent of cases.
After you create new tables, export the database schema to src/SnCore.Data/SnCoreSqlServer.sql.
-
Right click on the SnCore database in Enterprise Manager.
-
Choose All Tasks, Generate SQL Script.
-
Click Show All, select Script All Objects.
-
In Formatting remove the generation of DROP commands to preserve data on upgrade.
-
In Options, check all four Table Scripting Options.
-
Choose the MS-DOS file format and Create one file.
-
Confirm and save to SnCore.Data/SnCoreSqlServer.sql.
ObjectMapper is heavily used to generate NHibernate code to access data objects.
-
Download Puzzle Framework from http://www.puzzleframework.com/.
-
Launch ObjectMapper and open the src/SnCore.omproj project.
-
You must sync Data Source to Model, Tables to Classes and finally Model to Code. This produces the .cs and the .hbm.xml files in src/SnCore.Data.
-
Until this is fixed in Puzzle there're a few replacements to be made in all .hbm.xml files. Thse enable lazy binding in NHibernate, fix ID naming and fix byte array types. I use a macro to do this after each synchronization with the data model. The source code for the macro is in src/SnCore.Data/PuzzleMacros.vb.
-
You should be able to successfully run all unit tests after a synchronization and rebuild. See Unit Tests for more information.
|