Inheritance: IExample
Example #1
0
        public async Task EqualityWorksForUserTypeAsync()
        {
            using (var session = OpenSession())
                using (session.BeginTransaction())
                {
                    var newItem = new BarExample {
                        Value = "Larry"
                    };
                    var entities = await(session.Query <EntityWithUserTypeProperty>()
                                         .Where(x => x.Example == newItem)
                                         .ToListAsync());

                    Assert.AreEqual(1, entities.Count);
                }
        }
Example #2
0
        public async Task CanQueryWithHqlAsync()
        {
            using (var session = OpenSession())
                using (session.BeginTransaction())
                {
                    var newItem = new BarExample {
                        Value = "Larry"
                    };
                    var q = session.CreateQuery("from EntityWithUserTypeProperty e where e.Example = :exampleItem");
                    q.SetParameter("exampleItem", newItem);
                    var entities = await(q.ListAsync <EntityWithUserTypeProperty>());

                    Assert.AreEqual(1, entities.Count);
                }
        }
Example #3
0
        public void LinqMethodWorksForUserType()
        {
            using (var session = OpenSession())
                using (session.BeginTransaction())
                {
                    var newItem = new BarExample {
                        Value = "Larry"
                    };
                    var entities = session.Query <EntityWithUserTypeProperty>()
                                   .Where(x => x.Example.IsEquivalentTo(newItem))
                                   .ToList();

                    Assert.AreEqual(2, entities.Count);
                }
        }
Example #4
0
        public async Task LinqMethodWorksForExplicitUserTypeAsync()
        {
            using (var session = OpenSession())
                using (session.BeginTransaction())
                {
                    var newItem = new BarExample {
                        Value = "Larry"
                    };
                    var entities = await(session.Query <EntityWithUserTypeProperty>()
                                         .Where(x => x.Example.IsEquivalentTo(newItem.MappedAs(NHibernateUtil.Custom(typeof(ExampleUserType)))))
                                         .ToListAsync());

                    Assert.AreEqual(2, entities.Count);
                }
        }
Example #5
0
        public void EqualityWorksForExplicitUserType()
        {
            using (var session = OpenSession())
                using (session.BeginTransaction())
                {
                    var newItem = new BarExample {
                        Value = "Larry"
                    };
                    var entities = session.Query <EntityWithUserTypeProperty>()
                                   .Where(x => x.Example == newItem.MappedAs(NHibernateUtil.Custom(typeof(ExampleUserType))))
                                   .ToList();

                    Assert.AreEqual(1, entities.Count);
                }
        }