Search Results

Search found 1981 results on 80 pages for 'fluent nhibernate'.

Page 9/80 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Problem Upgrading NHibernate SQLite Application to .Net 4.0

    - by Xavin
    I have a WPF Application using Fluent NHibernate 1.0 RTM and System.Data.SQLite 1.0.65 that works fine in .Net 3.5. When I try to upgrade it to .Net 4.0 everything compiles but I get a runtime error where the innermost exception is this: `The IDbCommand and IDbConnection implementation in the assembly System.Data.SQLite could not be found.` The only change made to the project was switching the Target Framework to 4.0.

    Read the article

  • nHibernate persist IList<DayOfWeek>

    - by Charlie Brown
    Is it possible to persist an IList<DayOfWeek> using nHibernate? public class Vendor { public virtual IList<DayOfWeek> OrderDays { get; private set; } } If not, what are some common solutions; creating a class for OrderDays?, using an IList<string>?

    Read the article

  • nhibernate webforms with class library

    - by frosty
    very new to nhibernate. I'm a little confused on where features should live. I have the following solution 1) MyProject.Web ( web forms application) 2) MyProject.Domain( class lib) - nhibernate.config - product.hbm.xml So is it correct I should put the following method in a IHttpModule? ( i can't use a global asax as it's use by the CMS i'm running ) Where should the connectionString live? HTTPModule in web forms application private static ISessionFactory CreateSessionFactory() { var cfg = new Configuration().Configure(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "nhibernate.config")); cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionStringName, System.Environment.MachineName); NHibernateProfiler.Initialize(); return cfg.BuildSessionFactory(); } nhibernate.config <?xml version="1.0" encoding="utf-8" ?> NHibernate.Dialect.MsSql2005Dialect NHibernate.Connection.DriverConnectionProvider NHibernate.Driver.SqlClientDriver 16 web NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle enter code here

    Read the article

  • Linq to NHibernate, Order by Rand() ?

    - by Felipe
    Hi everybody, I'm using Linq To Nhibernate, and with a HQL statement I can do something like this: string hql = "from Entity e order by rand()"; Andi t will be ordered so random, and I'd link to know How can I do the same statement with Linq to Nhibernate ? I try this: var result = from e in Session.Linq<Entity> orderby new Random().Next(0,100) select e; but it throws a exception and doesn't work... is there any other way or solution? Thanks Cheers

    Read the article

  • How to delete data in DB efficiently using LinQ to NHibernate (one-shot-delete)

    - by kastanf
    Hello, producing software for customers, mostly using MS SQL but some Oracle, a decision was made to plunge into Nhibernate (and C#). The task is to delete efficiently e.g. 10 000 rows from 100 000 and still stay sticked to ORM. I've tried named queries - link already, IQuery sql = s.GetNamedQuery("native-delete-car").SetString(0, "Kirsten"); sql.ExecuteUpdate(); but the best I have ever found seems to be: using (ITransaction tx = _session.BeginTransaction()) { try { string cmd = "delete from Customer where Id < GetSomeId()"; var count = _session.CreateSQLQuery(cmd).ExecuteUpdate(); ... Since it may not get into dB to get all complete rows before deleting them. My questions are: If there is a better way for this kind of delete. If there is a possibility to get the Where condition for Delete like this: Having a select statement (using LinQ to NHibernate) = which will generate appropriate SQL for DB = we get that Where condition and use it for Delete. Thanks :-)

    Read the article

  • many-to-one with multiple columns

    - by Sly
    I have a legacy data base and a relation one-to-one between two tables. The thing is that relation uses two columns, not one. Is there some way to say in nhibernate that when getting a referenced entity it used two columns in join statement, not one? I'm trying to use this: References(x => x.Template) .Columns() .PropertyRef() But can't get how to map join on multiple columns, any ideas?

    Read the article

  • NHibernate Many-to-many with a boolean flag on the association table

    - by Nigel
    Hi I am doing some work on an application that uses an existing schema that cannot be altered. Whilst writing my NHibernate mappings I encountered a strange many-to-many relationship. The relationship is defined in the standard way as in this question with the addition of a boolean flag on the association table that signifies if the relationship is legal. This seems somewhat redundant but as I say, cannot be changed. Is it possible to define this relationship in Nhibernate without resorting to using a third class to represent the association? Perhaps by applying a filter? Many thanks.

    Read the article

  • NHibernate: how to do lookup a specific date in Nhibernate

    - by Daoming Yang
    How I can lookup a specific date in Nhibernate? I'm currently using this to lookup one day's order. ICriteria criteria = SessionManager.CurrentSession.CreateCriteria(typeof(Order)) .Add(Expression.Between("DateCreated", date.Date.AddDays(-1), date.Date.AddDays(1))) .AddOrder(NHibernate.Criterion.Order.Desc("OrderID")); I tried the following code, but they did bring the data for me. Expression.Eq("DateCreated", date) Expression.Like("DateCreated", date) Note: The pass in date value will be like this 2010-04-03 00:00:00, The actual date value in the database will be like this 2010-03-13 11:17:16.000 Can anyone let me know how to do this? Many thanks.

    Read the article

  • NHibernate and MySql is inserting and Selecting, not updating

    - by Chris Brandsma
    Something strange is going on with NHibernate for me. I can select, and I can insert. But I can't do and update against MySql. Here is my domain class public class UserAccount { public virtual int Id { get; set; } public virtual string UserName { get; set; } public virtual string Password { get; set; } public virtual bool Enabled { get; set; } public virtual string FirstName { get; set; } public virtual string LastName { get; set; } public virtual string Phone { get; set; } public virtual DateTime? DeletedDate { get; set; } public virtual UserAccount DeletedBy { get; set; } } Fluent Mapping public class UserAccountMap : ClassMap<UserAccount> { public UserAccountMap() { Table("UserAccount"); Id(x => x.Id); Map(x => x.UserName); Map(x => x.Password); Map(x => x.FirstName); Map(x => x.LastName); Map(x => x.Phone); Map(x => x.DeletedDate); Map(x => x.Enabled); } } Here is how I'm creating my Session Factory var dbconfig = MySQLConfiguration .Standard .ShowSql() .ConnectionString(a => a.FromAppSetting("MySqlConnStr")); FluentConfiguration config = Fluently.Configure() .Database(dbconfig) .Mappings(m => { var mapping = m.FluentMappings.AddFromAssemblyOf<TransactionDetail>(); mapping.ExportTo(mappingdir); }); and this is my NHibernate code: using (var trans = Session.BeginTransaction()) { var user = GetById(userId); user.Enabled = false; user.DeletedDate = DateTime.Now; user.UserName = "deleted_" + user.UserName; user.Password = "--removed--"; Session.Update(user); trans.Commit(); } No exceptions are being thrown. No queries are being logged. Nothing.

    Read the article

  • Updating the collections of entities with NHibernate the correct way

    - by karel_evzen
    A simple question regarding how NHibernate works: I have a parent entity that has a collection of other child entities. Those child entities have a reference to the parent entity they belong to. Now I want to implement an Add method to the parent entity that would add a child to it. Should that Add method only add the child to its new parents collection, or should it also update the parent reference of the child or should it also remove the added entity from its previous parents collection? Do I have to do all these things in that method or will NHibernate do something for me? Thanks.

    Read the article

  • Local Entities with NHibernate

    - by Ricardo Peres
    You may know that Entity Framework Code First has a nice property called Local which lets you iterate through all the entities loaded by the current context (first level cache). This comes handy at times, so I decided to check if it would be difficult to have it on NHibernate. It turned out it is not, so here it is! Another nice addition to an NHibernate toolbox! public static class SessionExtensions { public static IEnumerable<T> Local<T>(this ISession session) { ISessionImplementor impl = session.GetSessionImplementation(); IPersistenceContext pc = impl.PersistenceContext; foreach (Object key in pc.EntityEntries.Keys) { if (key is T) { yield return ((T) key); } } } } //simple usage IEnumerable<Post> localPosts = session.Local<Post>(); SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.0.320/scripts/clipboard.swf'; SyntaxHighlighter.brushes.CSharp.aliases = ['c#', 'c-sharp', 'csharp']; SyntaxHighlighter.all();

    Read the article

  • NHibernate Pitfalls: Lazy Scalar Properties Must Be Auto

    - by Ricardo Peres
    This is part of a series of posts about NHibernate Pitfalls. See the entire collection here. NHibernate supports lazy properties not just for associations (many to one, one to one, one to many, many to many) but also for scalar properties. This allows, for example, only loading a potentially large BLOB or CLOB from the database if and when it is necessary, that is, when the property is actually accessed. In order for this to work, other than having to be declared virtual, the property can’t have an explicitly declared backing field, it must be an auto property: 1: public virtual String MyLongTextProperty 2: { 3: get; 4: set; 5: } 6:  7: public virtual Byte [] MyLongPictureProperty 8: { 9: get; 10: set; 11: } All lazy scalar properties are retrieved at the same time, when one of them is accessed.

    Read the article

  • Problem with NHibernate

    - by Bernard Larouche
    I am trying to get a list of Products that share the Category. NHibernate returns no product which is wrong. Here is my Criteria API method : public IList<Product> GetProductForCategory(string name) { return _session.CreateCriteria(typeof(Product)) .CreateCriteria("Categories") .Add(Restrictions.Eq("Name", name)) .List<Product>(); } Here is my HQL method : public IList<Product> GetProductForCategory(string name) { return _session.CreateQuery("select from Product p, p.Categories.elements c where c.Name = :name").SetString("name",name).List<Product>(); } Both methods return no product when they should return 2 products. Here is the Mapping for the Product class : <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="CBL.CoderForTraders.DomainModel" namespace="CBL.CoderForTraders.DomainModel"> <class name="Product" table="Products" > <id name="_persistenceId" column="ProductId" type="Guid" access="field" unsaved-value="00000000-0000-0000-0000-000000000000"> <generator class="assigned" /> </id> <version name="_persistenceVersion" column="RowVersion" access="field" type="int" unsaved-value="0" /> <property name="Name" column="ProductName" type="String" not-null="true"/> <property name="Price" column="BasePrice" type="Decimal" not-null="true" /> <property name="IsTaxable" column="IsTaxable" type="Boolean" not-null="true" /> <property name="DefaultImage" column="DefaultImageFile" type="String"/> <bag name="Descriptors" table="ProductDescriptors"> <key column="ProductId" foreign-key="FK_Product_Descriptors"/> <one-to-many class="Descriptor"/> </bag> <bag name="Categories" table="Categories_Products" > <key column="ProductId" foreign-key="FK_Products_Categories"/> <many-to-many class="Category" column="CategoryId"></many-to-many> </bag> <bag name="Orders" generic="true" table="OrderProduct" > <key column="ProductId" foreign-key="FK_Products_Orders"/> <many-to-many column="OrderId" class="Order" /> </bag> </class> </hibernate-mapping> And finally the mapping for the Category class : <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="CBL.CoderForTraders.DomainModel" namespace="CBL.CoderForTraders.DomainModel" default-access="field.camelcase-underscore" default-lazy="true"> <class name="Category" table="Categories" > <id name="_persistenceId" column="CategoryId" type="Guid" access="field" unsaved-value="00000000-0000-0000-0000-000000000000"> <generator class="assigned" /> </id> <version name="_persistenceVersion" column="RowVersion" access="field" type="int" unsaved-value="0" /> <property name="Name" column="Name" type="String" not-null="true"/> <property name="IsDefault" column="IsDefault" type="Boolean" not-null="true" /> <property name="Description" column="Description" type="String" not-null="true" /> <many-to-one name="Parent" column="ParentID"></many-to-one> <bag name="SubCategories" inverse="true"> <key column="ParentID" foreign-key="FK_Category_ParentCategory" /> <one-to-many class="Category"/> </bag> <bag name="Products" table="Categories_Products"> <key column="CategoryId" foreign-key="FK_Categories_Products" /> <many-to-many column="ProductId" class="Product"></many-to-many> </bag> </class> </hibernate-mapping> Can you see what could be the problem ?

    Read the article

  • One to many in nhibernate mapping problem

    - by chobo2
    Hi I have this using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Demo.Framework.Domain { public class UserEntity { public virtual Guid UserId { get; protected set; } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TDemo.Framework.Domain { public class Users : UserEntity { public virtual string OpenIdIdentifier { get; set; } public virtual string Email { get; set; } public virtual IList<Movie> Movies { get; set; } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Demo.Framework.Domain { public class Movie { public virtual int MovieId { get; set; } public virtual Guid UserId { get; set; } // not sure if I should inherit UserEntity public virtual string Title { get; set; } public virtual DateTime ReleaseDate { get; set; } // in my ms sql 2008 database I want this to be just a Date type. Not sure how to do that. public virtual int Upc { get; set; } } } <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Demo.Framework" namespace="Demo.Framework.Domain"> <class name="Users"> <id name="UserId"> <generator class="guid.comb" /> </id> <property name="OpenIdIdentifier" not-null="true" /> <property name="Email" not-null="true" /> </class> <subclass name="Movie"> <list name="Movies" cascade="all-delete-orphan"> <key column="MovieId" /> <index column="MovieIndex" /> // not sure what index column is really. <one-to-many class="Movie"/> </list> </subclass> </hibernate-mapping> <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Demo.Framework" namespace="Demo.Framework.Domain"> <class name="Movie"> <id name="MovieId"> <generator class="native" /> </id> <property name="Title" not-null="true" /> <property name="ReleaseDate" not-null="true" type="Date" /> <property name="Upc" not-null="true" /> <property name="UserId" not-null="true" type="Guid"/> </class> </hibernate-mapping> I get this error 'extends' attribute is not found or is empty. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: NHibernate.MappingException: 'extends' attribute is not found or is empty. Source Error: Line 17: { Line 18: Line 19: var nhConfig = new Configuration().Configure(); Line 20: var sessionFactory = nhConfig.BuildSessionFactory(); Line 21:

    Read the article

  • NHibernate parent-childs save redundant sql update executed

    - by Broken Pipe
    I'm trying to save (insert) parent object with a collection of child objects, all objects are new. I prefer to manually specify what to save\update and when so I do not use any cascade saves in mappings and flush sessions by myself. So basically I save this object graph like: session.Save(Parent) foreach (var child in Parent.Childs) { session.Save(child); } session.Flush() I expect this code to insert Parent row, then each child row, however NHibernate executes this SQL: INSERT INTO PARENT.... INSERT INTO CHILD .... UPDATE CHILD SET ParentId=@1 WHERE Id=@2 This update statement is absolutely unnecessary, ParentId was already set correctly in INSERT. How do I get rid of it? Performance is very important for me.

    Read the article

  • Cascading items in a collection of a component

    - by mattcole
    I have a component which contains a collection. I can't seem to get NHibernate to persist items in the collection if I have the collection marked as Inverse. They will persist if I don't have Inverse on the collection, but I get an insert and then an update statement. My mapping is : m => m.Component(x => x.Configuration, c => { c.HasMany(x => x.ObjectiveTitleTemplates) .Access.ReadOnlyPropertyThroughCamelCaseField(Prefix.Underscore) .AsSet() //.Inverse() .KeyColumns.Add("ObjectiveProcessInstanceId") .Cascade.AllDeleteOrphan(); }); Is there a way to get it working marking the collection as Inverse and therefore avoiding the extra insert? Thanks!

    Read the article

  • Does NHibernate LINQ support ToLower() in Where() clauses?

    - by Daniel T.
    I have an entity and its mapping: public class Test { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual string Description { get; set; } } public class TestMap : EntityMap<Test> { public TestMap() { Id(x => x.Id); Map(x => x.Name); Map(x => x.Description); } } I'm trying to run a query on it (to grab it out of the database): var keyword = "test" // this is coming in from the user keyword = keyword.ToLower(); // convert it to all lower-case var results = session.Linq<Test> .Where(x => x.Name.ToLower().Contains(keyword)); results.Count(); // execute the query However, whenever I run this query, I get the following exception: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index Am I right when I say that, currently, Linq to NHibernate does not support ToLower()? And if so, is there an alternative that allows me to search for a string in the middle of another string that Linq to NHibernate is compatible with? For example, if the user searches for kap, I need it to match Kapiolani, Makapuu, and Lapkap.

    Read the article

  • nhibernate - mapping with contraints

    - by Tobias Müller
    Hello everybody, I am having a Problem with my nhibernate-mapping and I can't find a solution by searching on stackoverflow/google/documentation. The database I am using has (amongst others) two tables. One is unit with the following fields: id enduring_id starts ends damage_enduring_id [...] The other one is damage, which has the following fields: id enduring_id starts ends [...] The units are assigned to a damage and one damage can have zero, one or more units working on it. Every time a unit moves to annother damage, the dataset is copied. The field "ends" of the old record and "starts" of the new record are set to the current time stamp, enduring_id stays the same. So if I want to know which units were working on a damage at a certain time, I do the following select: select * from unit join damage on damage.enduring_id = unit.damage_enduring_id where unit.starts <= 'time' and unit.ends = 'time' (This is not an actualy query from the database, I made it up to make clear what I mean. The the real database is a little more complex) Now I want to map it that way, so I can load all the damages which are valid at one time (starts <= wanted time <= ends) and that each of them has a Bag with all the attached units at that time (again starts <= wanted time <= ends). Is this possible within the mapping? Sorry if this is a stupid question, but I am pretty new to nhibernate and I have no clue how to do it. Thanks a lot for reading my post! Bye, Tobias

    Read the article

  • NHibernate.MappingException on table insertion.

    - by Suja
    The table structure is : The controller action to insert a row to table is public bool CreateInstnParts(string data) { IDictionary myInstnParts = DeserializeData(data); try { HSInstructionPart objInstnPartBO = new HSInstructionPart(); using (ISession session = Document.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { objInstnPartBO.DocumentId = Convert.ToInt32(myInstnParts["documentId"]); objInstnPartBO.InstructionId = Convert.ToInt32(myInstnParts["instructionId"]); objInstnPartBO.PartListId = Convert.ToInt32(myInstnParts["part"]); objInstnPartBO.PartQuantity = Convert.ToInt32(myInstnParts["quantity"]); objInstnPartBO.IncPick = Convert.ToBoolean(myInstnParts["incpick"]); objInstnPartBO.IsTracked = Convert.ToBoolean(myInstnParts["istracked"]); objInstnPartBO.UpdatedBy = User.Identity.Name; objInstnPartBO.UpdatedAt = DateTime.Now; session.Save(objInstnPartBO); transaction.Commit(); } return true; } } catch (Exception ex) { Console.Write(ex.Message); return false; } } This is throwing an exception NHibernate.MappingException was caught Message="No persister for: Hexsolve.Data.BusinessObjects.HSInstructionPart" Source="NHibernate" StackTrace: at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName) at NHibernate.Impl.SessionImpl.GetEntityPersister(String entityName, Object obj) at NHibernate.Event.Default.AbstractSaveEventListener.SaveWithGeneratedId(Object entity, String entityName, Object anything, IEventSource source, Boolean requiresImmediateIdAccess) at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event) at NHibernate.Event.Default.DefaultSaveEventListener.SaveWithGeneratedOrRequestedId(SaveOrUpdateEvent event) at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event) at NHibernate.Event.Default.DefaultSaveEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event) at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event) at NHibernate.Impl.SessionImpl.FireSave(SaveOrUpdateEvent event) at NHibernate.Impl.SessionImpl.Save(Object obj) at HexsolveMVC.Controllers.InstructionController.CreateInstnParts(String data) in F:\Project\HexsolveMVC\Controllers\InstructionController.cs:line 1342 InnerException: Can anyone help me solve this??

    Read the article

  • Need help with simple NHibernate mapping...

    - by mplarsen
    Need help with a simple NHibernate relationship... Tables/Classes Request ------- RequestId Title … Keywords ------- RequestID (key) Keyword (key) Request mapping file <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="CR.Model" assembly="CR"> <class name="CR.Model.Request, CR table="[dbo].[Request]" lazy="true"> <id name="Id" column="[RequestID]"> <generator class="native" /> </id> <property name="RequestorID" column="[RequestorID]" /> <property name="RequestorOther" column="[RequestorOther]" /> … Keyword?? </class> </hibernate-mapping> How do I simply map multiple keywords to a request? I don't need another mapping file for the keyword class, do I? It's be great if I could not only get the associated keywords, but add them too...

    Read the article

  • NHibernate with string primary key and relationships

    - by John_
    I've have just been stumped with this problem for an hour and I annoyingly found the problem eventually. THE CIRCUMSTANCES I have a table which users a string as a primary key, this table has various many to one and many to many relationships all off this primary key. When searching for multiple items from the table all relationships were brought back. However whenever I tried to get the object by the primary key (string) it was not bringing back any relationships, they were always set to 0. THE PARTIAL SOLUTION So I looked into my logs to see what the SQL was doing and that was returning the correct results. So I tried various things in all sorts of random ways and eventually worked out it was. The case of the string being passed into the get method was not EXACTLY the same case as it was in the database, so when it tried to match up the relationship items with the main entity it was finding nothing (Or at least NHIbernate wasn't because as I stated above the SQL was actually returning the correct results) THE REAL SOLUTION Has anyone else come across this? If so how do you tell NHibernate to ignore case when matching SQL results to the entity? It is silly because it worked perfectly well before now all of a sudden it has started to pay attention to the case of the string.

    Read the article

  • nhibernate many to many deletes

    - by asi farran
    I have 2 classes that have a many to many relationship. What i'd like to happen is that whenever i delete one side ONLY the association records will be deleted with no concern which side i delete. simplified model: classes: class Qualification { IList<ProfessionalListing> ProfessionalListings } class ProfessionalListing { IList<Qualification> Qualifications void AddQualification(Qualification qualification) { Qualifications.Add(qualification); qualification.ProfessionalListings.Add(this); } } fluent automapping with overrides: void Override(AutoMapping<Qualification> mapping) { mapping.HasManyToMany(x => x.ProfessionalListings).Inverse(); } void Override(AutoMapping<ProfessionalListing> mapping) { mapping.HasManyToMany(x => x.Qualifications).Not.LazyLoad(); } I'm trying various combinations of cascade and inverse settings but can never get there. If i have no cascades and no inverse i get duplicated entities in my collections. Setting inverse on one side makes the duplication go away but when i try to delete a qualification i get a 'deleted object would be re-saved by cascade'. How do i do this? Should i be responsible for clearing the associations of each object i delete?

    Read the article

  • nhibernate not taking mappings from assembly

    - by cvista
    Hi I'm using fnh and castle nhib facility. I followed the advice from mike hadlow here: http://mikehadlow.blogspot.com/2009/01/integrating-fluent-nhibernate-and.html here is my FluentNHibernateConfigurationBuilder: public Configuration GetConfiguration(IConfiguration facilityConfiguration) { var defaultConfigurationBuilder = new DefaultConfigurationBuilder(); var configuration = defaultConfigurationBuilder.GetConfiguration(facilityConfiguration); configuration.AddMappingsFromAssembly(typeof(User).Assembly); return configuration; } i know the facility is picking it up as i can break inside that method and it steps through. however, when it's done, non of the mappings are created and i get the following error when i try to save an entity: No persister for: IsItGd.Model.Entities.User here is my user class: //simple model of web user public class User { public virtual int Id { get; set; } public virtual string FullName { get; set; } } and here is the mapping: public class UserMap : ClassMap<User> { public UserMap() { Id(x=>x.Id); Map(x=>x.FullName); } } i really can't see what the problem is. the strange thing is - is that if i use automapping it picks everything up - but i don't want to use automapping as i can't do certain things in that scenario. any clues? w://

    Read the article

  • NHibernate slow mapping

    - by Rob A
    My question is what can I do to determine the cause of the slowness, or what can I do to speed it up without knowing the exact cause. I am running a simple query and it appears that the mapping back to the entities is taking taking forever. The result set is 350, which is not much data in my opinion. IRepository repo = ObjectFactory.GetInstance<IRepository>(); var q = repo.Query<Order>(item => item.Ordereddate > DateTime.Now.AddDays(-40)); foreach (var order in q) { Console.WriteLine(order.TransactionNumber); } The profiler is telling me it is executing the query 7ms / 35257ms, I am assuming that the former is the actual response from the db and the latter is the time it takes NH to do it's magic. 35 seconds is too long. This is a simple mapping, one table, nested components, using fluent interface to do mappings. I just start up a simple console app and run the one query, the slowness is measured after the SessionFactory is initialized, there should only be one session, and I am not using a transaction. Thanks

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >