Exemple #1
0
 public void Should_map_even_when_using_aop_proxy()
 {
     var proxyBuilder = new ProxyBuilder();
     _person = proxyBuilder.GetProxy(new Person { Age = 20, FirstName = "Foo", LastName = "Bar" });
     using (var session = _sessionBuilder.GetSession())
     {
         using (var transaction = session.BeginTransaction())
         {
             session.Save(_person);
             transaction.Commit();
         }
     }
     using (var session = _sessionBuilder.GetSession())
     {
         using (var transaction = session.BeginTransaction())
         {
             var people = session.CreateCriteria<Person>().List<Person>();
             transaction.Commit();
             people.Count.ShouldEqual(1);
             people[0].Age.ShouldEqual(20);
             people[0].FirstName.ShouldEqual("Foo");
             people[0].LastName.ShouldEqual("Bar");
         }
     }
 }
Exemple #2
0
 public Person GetProxy(Person target)
 {
     var proxyFactory = new ProxyFactory(target) {ProxyTargetType = true};
     return (Person) proxyFactory.GetProxy();
 }