Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.NHibernate/NhHelper.cs @ 143:2dbb15f4510f
Asociar Twitter a Persona existente
author | Nelo@Guinea.neluz.int |
---|---|
date | Mon, 01 Aug 2011 09:41:29 -0300 |
parents | 3639803112c6 |
children | 5a1f7233aa5a |
comparison
equal
deleted
inserted
replaced
142:62dc9fb3a03e | 143:2dbb15f4510f |
---|---|
1 using System; | 1 using AltNetHispano.Agendas.Domain; |
2 using System.Collections.Generic; | |
3 using System.Data; | |
4 using AltNetHispano.Agendas.Domain; | |
5 using ConfOrm; | 2 using ConfOrm; |
6 using ConfOrm.NH; | 3 using ConfOrm.NH; |
7 using NHibernate; | 4 using NHibernate; |
8 using NHibernate.Cfg; | 5 using NHibernate.Cfg; |
9 using NHibernate.Tool.hbm2ddl; | 6 using NHibernate.Tool.hbm2ddl; |
10 using NHibernate.Type; | |
11 using NHibernate.UserTypes; | |
12 | 7 |
13 namespace Agendas.NHibernate | 8 namespace Agendas.NHibernate |
14 { | 9 { |
15 public static class NhHelper | 10 public static class NhHelper |
16 { | 11 { |
36 orm.Cascade<Persona, Evento>(Cascade.None); | 31 orm.Cascade<Persona, Evento>(Cascade.None); |
37 | 32 |
38 orm.Cascade<Persona, Cuenta>(Cascade.All | Cascade.DeleteOrphans); | 33 orm.Cascade<Persona, Cuenta>(Cascade.All | Cascade.DeleteOrphans); |
39 | 34 |
40 var mapper = new Mapper(orm); | 35 var mapper = new Mapper(orm); |
36 | |
37 mapper.Customize<Persona>(a => a.Property(p => p.Nombre, m => m.Unique(true))); | |
38 mapper.Customize<Persona>(a => a.Property(p => p.Twitter, m => m.Unique(true))); | |
41 | 39 |
42 mapper.AddPropertyPattern(p => p.DeclaringType == typeof(Evento) && p.Name == "Estado", a => a.Type<EventoStateType>()); | 40 mapper.AddPropertyPattern(p => p.DeclaringType == typeof(Evento) && p.Name == "Estado", a => a.Type<EventoStateType>()); |
43 | 41 |
44 var mapping = mapper.CompileMappingFor(typeof(Evento).Assembly.GetTypes()); | 42 var mapping = mapper.CompileMappingFor(typeof(Evento).Assembly.GetTypes()); |
45 | 43 |