Skip to content
Christopher Davis edited this page Jan 17, 2020 · 32 revisions

You can also join the LinkedIn group. LinkedIn Group

Clone the Simple Model project

nHydrate for Entity Framework Core

Getting Started

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 Framework)

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)

Multi-Tenancy A new feature now allows you to build multi-tenant applications. (See Multi-Tenancy)

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 Query Plans)

Simple Syntax 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 Code Samples)

Many-to-Many We have added additional support for many-to-many relations. Standard Entity Framework requires a cumbersome intermediate entity paradigm in order to support this type of relation. This has been simplified this process to be more intuitive. (See Many-to-Many)

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 VS Integration)

Numerous Building Blocks The framework allows you to model and generate Entities, Typed Lists, Typed Views, and Stored Procedures. (See Custom Stored Procedures)

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 Relationships)

Dependency Walking 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.

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.

Typed Lists 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.

Immutable Objects 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.

Server-side paging 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.

In-memory filtering and sorting using LINQ Use the new LINQ syntax to sort or filter data in memory.

Auditing Support 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 Auditing)

Validation support 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.

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.

Load objects with LINQ syntax Being Entity Framework the full LINQ syntax is available for queries. When a model changes, compile time errors are generated alerting developers to problems.

Patterns based generated code All generated code uses various well-known patterns that forms its functionality. Some patterns used are the Observer, Active Record, Repository, Visitor, Composite, and Interpreter and Data Transfer patterns.

Partial classes All classes are generated as partials with a gen-once file and a gen-always file. Add any code to the gen-once file and it is never overwritten. This allows for the easy extension and customization of entities.

Fully object oriented, typed query mechanism

  • 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.

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. This removes the “lost update problem” problem, where multiple users change the same record simultaneously.

Dynamic SQL Support If a some custom action or query is required, it can be included in the model with a custom view and stored procedure. This allows strongly-typed entities to be generated based on your custom specification and parameters.

Start Working Immediately There is no setup time for days and weeks. Simply 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!

You can’t perform that action at this time.