THIS PROJECT HAS MOVED TO GITHUB
Use model-driven architecture! Stop hand-coding and start generating. This platform creates strongly-typed, extendable classes inside of a framework. It is completely integrated into VS.NET. The model controls database generation, LINQ syntax, API, DAL,
*Note: The first public release has been posted. You are the steering committee, so please give feedback. Please realize that is a non-commercial work in progress, so please be kind.
Compare to NHibernate
Do you save time with NHibernate?
Oracle and MySQL Survey
Support the Effort
Click here to take survey
If you use the product and want to help us move it forward, please think about donating to the project.
Donate to the project
New Visual Modeler
Preview the new
The 4.1 line has ended as of February 23, 2012. The last build was 22.214.171.124. Version 5.0 is now the trunk, which is the visual modeler.
MySql now supported
Please try the new MySql functionality and give us some feedback.
Check out the MySql sample site. http://bit.ly/PG7YWe
We are now now posting How-To videos on YouTube.com. Follow some of the examples and get up and running sooner.
You can also join the LinkedIn group.
Follow us on Twitter
Watch for new Code Project Articles
nHydrate Generator Features
True Model Driven Architecture (MDA)
You can manage your whole architectural framework from the modeler. The generated code allows you manage your database and all underlying framework code. You literally can concentrate on the business rules of your application not the framework. (See
Powerful code generation framework
The generated framework has just about everything you will ever need for your application’s API. There is just about no reason to go outside the framework for anything. You can version your database; perform database updates or creations; access a database
in numerous ways; save data; and perform aggregate functions.
Evolutionary Database Design
Track database changes using tracking techniques. (See
Evolutionary Database Design
feature now allows you to build multi-tenant applications. (See
Written with performance in mind
The generated code allows you to query data with minimal code. It is all Entity Framework based, so all it is industry standard. Fields can be optimized for fast database selects. All collections have overloaded static methods that allow complex queries to
be constructed in one line. In addition, you can also update multiple database records with one line with static methods. (See
Unlike many code generators, you can perform many actions with one line of code. Many generators do create source code, but it takes a lot of code to use it. nHydrate allows you to select, persist, even bulk update in one line. (See
Visual Studio Integration
After looking at many other code generators what is your biggest gripe. Chances are it is no VS.NET integration. With complete integration into the .NET environment, your classes are generated right into the Project Explorer. There is no need to manually include
files in your project. After your generation is complete you can compile, that simple. (See
Numerous Building Blocks
The framework allows you to model and generate Entities, Typed Lists, Typed Views, and Stored Procedures. (See
Custom Stored Procedures
Using inheritance is easy. Simply set the parent table of an entity. It is that simple. If the validation criteria is met, the generator will create a seemly object inheritance hierarchy. When referencing a child object, all parent properties, methods and custom
code are available. This is because inherited objects are really derived in code from the base objects. (See
Support for all relation types
You can model and generate 1:1, 1:N, and N:M relations in the model. There is no need to write any custom for select by defined database relationships. (See
There is no need to write any custom code to walk relationships. Each entity with a 1:N relation will reference the foreign table with a list of objects that will be retrieved automatically when requested. This is completely transparent to you. In addition,
each 1:1 relation will have a single related foreign object. Finally each N:N relation will have list of foreign objects in both directions. The retrievals are done in the background or can be cached to load all at once. (See
Full support for complex database constructions
Full support for primary keys, foreign key constraints, unique constraints, defaults, identity fields, GUID fields, sequences, code facades, views, stored procedures, relations with self, multi-field primary keys, multi-field foreign keys, multi-field unique
constraints, objectified m:n relations, and much more.
Support for modified relational schemas
Version a database and keep track of your model changes between deployments. You can create an upgrade track between versions allows you to upgrade any lower version to a higher version. The database installer is generated from your model and contains all information
to upgrade a database or create it from scratch. It can run in Microsoft InstallUtil tool or plug it directly into a larger installation application.
You can define Type tables that generate an enumeration to be used in code. This allows you to write code that is easy to read instead of using “magic numbers” for properties.
Create read-only objects that can be loaded from the database but cannot be modified or persisted. This is closely related to type tables but not the same thing. You can define objects as immutable without an associated type or enumeration if desired.
Graph-aware Save Logic
You can load and manipulate data in any order. There is no need to write any custom code to define save logic. All subdomains have a Persist method that knows the order in which to save data to your database. You can load, add, delete, and modify data in any
way. You can even dependency walk from any loaded collection to any other object or collection (loaded or not loaded) to get new data at any time. Persistence is automatic and transparent.
Persistence of 'dirty' (changed) data only
Only 'dirty' entities are persisted to the database. The entire parent-child hierarchy is saved but only the modified and added entities are persisted to store.
All objects are disconnected from the database
All objects are disconnected from the database and from every other object. You can use the entity objects, typed list objects and typed view objects without having a connection to the database; no database connection is kept open after you have fetched an
entity. All loading and persistence is atomic.
Full paging support is available for collections. Paging is performed on the database server, so only necessary data is brought to the client and loaded into memory. (See
In-memory filtering and sorting using LINQ
Use the new LINQ syntax to sort or filter data in memory.
Two types of auditing are supported. The first is built-in fields for tables that allows you to track the person that added or modified a record and the date. The second is a shadow table that stores all add, edit, and delete operations on a table. This is
a history table that can be queried to determine any state of a record in a table. (See
There is a validation framework, which makes it very easy to add validation code to the generated classes and intercept actions on the entities. Each property has events that are raised during and after modifications. There are also hooks in to the Persistence
mechanisms. The framework also supports client-side null validation and length validation before you save changes.
Singularization and Pluralization of Entity Names
Singularization of entities and pluralization of lists is built-in.
Exclude fields from entity fetches
You can define components on tables which are subsets of tables. You can manipulate these entities just like tables, even persisting them. This is quiet useful for legacy systems or large tables with blob or image fields.
Callbacks and Notifications
The generated objects follow the observer pattern in that you can register for notification of events. Each object has a global event that is raised before and after a field is changed. There are also events for each individual field so you can capture a message
for a single field.
Unit of Work and multi-versioning of entities or sets
You inheritably define a unit of by using the framework. All CRUD actions are built-up and saved at one time in one transaction. This is a unit of work and all action will succeed or fail as an atomic transaction.
Advanced lazy loading/load on demand
Walk any relationship in the model with no custom code at all. This is built-in and you get it out of the box. Simply call a related object or collection of an entity and if it is not already in the subdomain it will be loaded automatically. This is completely
transparent to you.
Advanced prefetch functionalty of related entities
Lazy loading is the easiest way to get data, but you can also define the entities to be loaded and do so in a transaction.
Load objects with LINQ syntax
You can load any collection with a strongly-typed LINQ syntax. If your model changes, you will get a compile time error. You will not ship a product to break in the field anymore. There is never a reason to retrieve an entity property by string value like a
Patterns based generated code
All generated code uses various well-known patterns to form a working layer and to deliver its functionality. Patterns used are the Observer, Active Record, Repository, Visitor, Composite, and Interpreter and Data Transfer patterns. (See
Code added to the generated classes is preserved
All classes are generated as partial classes with a gen-once file and a gen-always file. You can add any code you to the gen-once file and it is never overwritten. This code is merged with the generated class file to create one class. There is no need to write
code only in specified regions like most code generators. You can write any free form code you wish.
Generated code is built with partial classes, which makes it easy to extend the generated code, through the partial class mechanism in .NET 2.0+.
Generics and nullable types supported
If a field is defined as nullable in the database, it is nullable in code as well.
Fully object oriented, typed query mechanism
Support for aggregate functionality
- Table joins seen as object relations and used to create object and list references on an entity
- Compile time checked filter construction, with easy to formulate constructs like (Customer.Order.Product.Name == "Widget")
- Support for relations (1:1, 1:n, n:m)
- Predicate specification with static entity collection methods.
- 100% typed dynamic filter construction using Predicates
- Support for sorting, filtering and resultset limitations (number of rows returned)
- Support for strongly-typed aggregate querying, i.e. when you aggregate an integer value you get back an integer value. You are never returned an “object” type.
- Join tables on multiple relationships by giving each a role name. The specified name is in the generated code and is used to distinguish which relationship is being walked.
- Fully integrated inheritance. A derived object has all of its properties and those of its parent. There is no need for a developer to know the entire inheritance hierarchy. You can work with an object as if it were stand-alone. There is no need to know
which property comes from which entity in the inheritance tree.
Call aggregates with one line of code, even with complex logic. For example you can call the count aggregate like so “CustomerCollection.GetCount(x=>x.CustomerId < 100)” (See
). This is strongly-typed and any change in the reference fields will be validated by the compiler. (See
Concurrency Control Mechanism
Concurrency is built-in with a timestamp field. If a database row is changed by another user while in memory, the concurrency will fail and an exception will be raised. You will never get the “lost update problem” again.
Dynamic SQL Support
If there is some custom action or query that you need that is not provided by the framework, you can include it in the framework with custom view and custom stored procedures. This allows strongly-typed objects to be generated based on your custom specification
Start Working Immediately
There is no setup time for days and weeks. Simple reverse engineer your database into a model (or create one from scratch). Setup your metadata, naming schema, etc and generate. You can start building code immediately. There are no cumbersome XML configuration
files to write by hand!
Conceive, Model, Generate!