Strategies for Using NHibernate to Create a Schema

I am creating a new application that uses NHibernate to generate a database schema, but I can see a possible problem in the future.

Obviously, you use all the data from your database, it is cleared when the scheme is updated, but what strategies do people use to restore any data in the new database. I know that massive changes to the circuit will lead to difficulties, but I wonder how other people handled this problem.

Cheers Colin G

PS I will not do this against a live database, only using it to restore test data for integration test and continuous integration

+3
source share
5 answers

NHibernate , . Sqlite , .

:

public class CustomerBuilder : Builder<Customer>
{
   string firstName;
   string lastName;
   Guid id = Guid.Empty;

   public override Customer Build()
   {
      return new Customer() { Id = id, FirstName = firstName, LastName = }
   }

   public CustomerBuilder WithId(Guid newId)
   {
      id= newId;
      return this;
   }

   public CustomerBuilder WithFirstName(string newFirstName)
   {
      firstName = newFirstName;
      return this;
   }

   public CustomerBuilder WithLastName(string newLastName)
   {
      lastName = newLastName;
      return this;
   }
}

:

var customer = new CustomerBuilder().WithFirstName("John").WithLastName("Doe").Build();

TDD, scatch , , , , .

+5

, , NHibernate . , , (, NUnit), SQL script, .

+1

, @Chris Canal -

, , , "", # 3.0?

. :

var customer = new CustomerBuilder(). WithFirstName ( "John" ). WithLastName ( "Doe" ). Build();

"", (, , , )?

var customer = new Customer {FirstName = "John", LastName = "Doe" };

+1

NHibernate. SQLCompare . SQLCompare .

NHibernate, .

0

. NHibernate . SQLite .

/ SQLCompare , .

0

All Articles