private IList<ProductDto> GetProductList(SSUser user) { ProductDto productDto = null; SSUser userJoin = null; return UnitOfWork.CurrentSession.QueryOver<Product>() .JoinAlias(x => x.Owner, () => userJoin) .Where(x => x.Owner == user) .SelectList(u => u.Select(x => x.Name).WithAlias(() => productDto.Name)) .TransformUsing(Transformers.AliasToBean<ProductDto>()) .List<ProductDto>(); //var productList = UnitOfWork.CurrentSession.QueryOver<Product>() // .JoinAlias(x => x.Owner, () => userJoin) // .Where(() => userJoin == user) // .List<Product>(); // //var productListDto = new List<ProductDto>(); //foreach (var product in productList) //{ // productListDto.Add(new ProductDto // { // Name = product.Name // }); //} // // //return productListDto; }
public void DummyData() { var user = new SSUser { Name = "Ali", BirthDate = DateTime.Now, ViewCount = 500 }; UnitOfWork.CurrentSession.SaveOrUpdate(user); var product = new Product { Name = "Ürün", Owner = user }; UnitOfWork.CurrentSession.SaveOrUpdate(product); using (var tran = UnitOfWork.CurrentSession.BeginTransaction()) { tran.Commit(); } }