This project is read-only.

Project: DataAnnotations

Use the same DataAnnotations for:
  1. mapping for NHibernate 3.2
  2. mapping for EntityFramework
  3. metadata class to validate ASP.NET MVC ViewModel

So you can easily switch between NHibernate and EntityFramework!

The domain class:
public class Vehicle
	: Entity<Guid>, IVehicle
	public virtual string Name { get; set; }

The metadata class that defines DataAnnotations:
public class VehicleMetadata
	: EntityMetadata,
	public string Name { get; set; }

The Unit Of Work ORM-agnostic interface:
public interface IVehicleUnitOfWork
	: IDisposable
	IRepository<Vehicle> VehicleRepository { get; }

	void Commit();

At the and the configuration using NHIbernate "by-code" mapping:
var mapper = new DataAnnotationsModelMapper();

Last edited Oct 26, 2011 at 11:58 AM by teoarch, version 1


No comments yet.