nhibernate

NHibernate.Mapping.Attributes.Filter

倾然丶 夕夏残阳落幕 提交于 2020-01-15 12:13:32
问题 I'm mapping my database tables using NHibernate with NHibernate.Mapping.Attributes library and I got stuck to get the Filter attributes to work. Suppose a class A that has a set of objects of class B. So, I have, the following: [NHibernate.Mapping.Attributes.Set(0, Inverse = true, Lazy = NHibernate.Mapping.Attributes.CollectionLazy.False)] [NHibernate.Mapping.Attributes.Key(1, Column = "ClassAId")] [NHibernate.Mapping.Attributes.OneToMany(2, Class = "ClassB, Assembly")] public virtual ISet

NHibernate.Mapping.Attributes.Filter

杀马特。学长 韩版系。学妹 提交于 2020-01-15 12:13:03
问题 I'm mapping my database tables using NHibernate with NHibernate.Mapping.Attributes library and I got stuck to get the Filter attributes to work. Suppose a class A that has a set of objects of class B. So, I have, the following: [NHibernate.Mapping.Attributes.Set(0, Inverse = true, Lazy = NHibernate.Mapping.Attributes.CollectionLazy.False)] [NHibernate.Mapping.Attributes.Key(1, Column = "ClassAId")] [NHibernate.Mapping.Attributes.OneToMany(2, Class = "ClassB, Assembly")] public virtual ISet

Unable to load proxy factory factory exception

余生长醉 提交于 2020-01-15 11:53:49
问题 I am having this annoying error while running my Nhibernate project. It was running okey and all of a sudden it just start asking for a file in this path "d:\CSharp\NH\NH\nhibernate\src\NHibernate\Bytecode\AbstractBytecodeProvider.cs" and when cancel, it throws an exception saying it says Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly

Unable to load proxy factory factory exception

♀尐吖头ヾ 提交于 2020-01-15 11:53:30
问题 I am having this annoying error while running my Nhibernate project. It was running okey and all of a sudden it just start asking for a file in this path "d:\CSharp\NH\NH\nhibernate\src\NHibernate\Bytecode\AbstractBytecodeProvider.cs" and when cancel, it throws an exception saying it says Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class. Possible causes are: - The NHibernate.Bytecode provider assembly

Dynamically creating WrapPanel buttons

瘦欲@ 提交于 2020-01-15 11:47:06
问题 I have a table storing purchased items and the entity class using in NHibernate: public class PurchasedItem { public virtual int Id { get; set; } public virtual Product Product { get; set; } public virtual int SortSale { get; set; } } I would like to reduce the code duplication by getting all records from the PurchasedItems table ( IList <PurchasedItem> object). Records have been sorted in descending order by SortSale column. What's the best way of creating WrapPanel buttons based on the

Howcome I populate selectlist with list of categories

丶灬走出姿态 提交于 2020-01-15 10:40:07
问题 What I want to do is to populate SelectList with categories from a categories repository. A little mockup http://mockupbuilder.com/App/15379. What I have now is a controller: [HandleError] public class ProductController : Controller { private IRepository<Product> exhibitions; private IRepository<Category> categories; private readonly Int32 PageSize = 18; // ctor ... [HttpPost] public ActionResult Create(Product product, Guid categoryId) { // validation ... // properties setting ... product

NHibernate equivalent of Entity Framework “Future Queries”

99封情书 提交于 2020-01-15 10:18:05
问题 There is an extension to Entity Framework called Future Queries that allows queries to be batched up and processed at the same time. For example, from their docs: // build up queries var q1 = db.Users .Where(t => t.EmailAddress == "one@test.com") .Future(); var q2 = db.Tasks .Where(t => t.Summary == "Test") .Future(); // this triggers the loading of all the future queries var users = q1.ToList(); Is there any equivalent in NHibernate, or an extension that might give this type of functionality

Null and empty values property from inside class in Nhibernate

匆匆过客 提交于 2020-01-15 09:45:12
问题 I get null values from inside class mapping with nHibernate, please see below: public class IndicadorRepository : Repository<IndicadorRepository> { ... public Indicador FindById(int indicadorId) { return _session.Get<Indicador>(indicadorId); } ... } Repository.cs public class Repository<T> where T : Repository<T>, new() { /* Properties */ protected static T instance; public ISession _session; public static T Instance { get { if (instance == null) instance = new T(); return instance; } } /*

Fluent Nhibernate: Can't create database connection to MySQL

时光毁灭记忆、已成空白 提交于 2020-01-15 09:41:31
问题 I have been looking into Fluent Nhibernate, and it seems really promising. But... I can't seem to get it working with a MySQL database. I have the Fluent Nhibernate example project running fine with the SQLite database (Fluent NHibernate: Getting Started), but as soon as I change the database configuration to this: return Fluently.Configure() .Database(MySQLConfiguration.Standard.ConnectionString( x => x.Database("database") .Server("server") .Username("login") .Password("password") ) )

nHibernate one-to-many inserts but doesnt update

筅森魡賤 提交于 2020-01-15 09:09:33
问题 Instead of getting into code, I have a simple question. Default behavior for a simple one-to-many is that it inserts the child record then updates the foreign key column with the parent key. Has anyone ever had a one-to-many where the child object gets inserted but not updated resulting in a row in my table with a null in the foreign key column? I want the default behaviour for a standard one-to-many. I don't want to have to add the parent as a property to the child. Thanks. 回答1: This would