Search Results

Search found 6205 results on 249 pages for 'linq to nhibernate'.

Page 35/249 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • Is it possible to mimic IQueryable with NHibernate?

    - by George
    Is it possible to mimic IQueryable with NHibernate? I was looking at Nhibernate docs and for what i could tell, it always returns a List of objects, that have it's attributes indexed by a integer. Ok, perfect, that works. But is there a way to retrieve objects like LINQ? With something like IQueryable? Thanks

    Read the article

  • Insert problem with Oracle using Nhibernate

    - by Orkun Balkanci
    There is a CLOB field we are trying to insert html content and sometimes we are getting an error as: ORA-01461: can bind a LONG value only for insert into a LONG column When i used nhibernate profiler and copy the query to Toad, it asked me to enter values for variables called "NBSP"! Is this means that nhibernate doesnt escape special chars? if so how can i tell it to escape special chars globally?

    Read the article

  • nhibernate subclass in code

    - by Antonio Nakic Alfirevic
    I would like to set up table-per-classhierarchy inheritance in nhibernate thru code. Everything else is set in XML mapping files except the subclasses. If i up the subclasses in xml all is well, but not from code. This is the code i use - my concrete subclass never gets created:( //the call NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration(); SetSubclass(config, typeof(TAction), typeof(tActionSub1), "Procedure"); //the method public static void SetSubclass(Configuration configuration, Type baseClass, Type subClass, string discriminatorValue) { PersistentClass persBaseClass = configuration.ClassMappings.Where(cm => cm.MappedClass == baseClass).Single(); SingleTableSubclass persSubClass = new SingleTableSubclass(persBaseClass); persSubClass.ClassName = subClass.AssemblyQualifiedName; persSubClass.DiscriminatorValue = discriminatorValue; persSubClass.EntityPersisterClass = typeof(SingleTableEntityPersister); persSubClass.ProxyInterfaceName = (subClass).AssemblyQualifiedName; persSubClass.NodeName = subClass.Name; persSubClass.EntityName = subClass.FullName; persBaseClass.AddSubclass(persSubClass); } the Xml mapping looks like this: <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Riz.Pcm.Domain.BusinessObjects" assembly="Riz.Pcm.Domain"> <class name="Riz.Pcm.Domain.BusinessObjects.TAction, Riz.Pcm.Domain" table="dbo.tAction" lazy="true"> <id name="Id" column="ID"> <generator class="guid" /> </id> <discriminator type="String" formula="(select jt.Name from TJobType jt where jt.Id=JobTypeId)" insert="true" force="false"/> <many-to-one name="Session" column="SessionID" class="TSession" /> <property name="Order" column="Order1" /> <property name="ProcessStart" column="ProcessStart" /> <property name="ProcessEnd" column="ProcessEnd" /> <property name="Status" column="Status" /> <many-to-one name="JobType" column="JobTypeID" class="TJobType" /> <many-to-one name="Unit" column="UnitID" class="TUnit" /> <bag name="TActionProperties" lazy="true" cascade="all-delete-orphan" inverse="true" > <key column="ActionID"></key> <one-to-many class="TActionProperty"></one-to-many> </bag> <!--<subclass name="Riz.Pcm.Domain.tActionSub" discriminator-value="ZPower"></subclass>--> </class> </hibernate-mapping> What am I doing wrong? I can't find any examples on google:(

    Read the article

  • NInject2 Interceptor usage with NHibernate transactions

    - by Daniil Harik
    Hello, In my previous project we used NHibernate and Spring.NET. Transactions were handled by adding [Transaction] attribute to service methods. In my current project I'm using NHibernate and NInject 2 and I was wondering if it's possible to solve transaction handling using "Ninject.Extensions.Interception" and similar [Transaction] type attributes? Thank You very much!

    Read the article

  • nHibernate versus LLBLGen Pro

    - by Rippo
    I am trying to work out with ORM tool to move over to and have narrowed it down to two candidates. nHibernate or LLBLGen Pro Please can you guys give me pros and cons in using both these tools especially if you have experience in both. I am not really interested in any other tools but am wanting some heads up so I can decide which tool to spend time learning.... I already know that one is free and one isn't, I also know that nHibernate might take some learning.... Many thanks, Richard

    Read the article

  • Lazy property loading in Nhibernate and Spring

    - by Khash
    I'm using NHibernate 2.1.2 and Spring 1.3 I have two Text columns (blobs) in one of my classes. I'm trying to use lazy="true" for the mapping of those properties but NHProfiler still shows the two columns being added to the SELECT statement when the main object is loaded. I'm using Spring.NHibernate session factory and have configured ProxyFactory with both Castle and Spring with no luck.

    Read the article

  • nHibernate: limit the result set of a mapped collection

    - by HeavyWave
    How do you limit the result set of a mapped collection in nHibernate? For instance: Model.Items; will always return all the Items for the given Model. Is there any way to force it to return only, say, 20 Items without creating a specific query ? Something like Model.Items.SetMaxResults(20); In other words, I would like nHibernate to return IQueryable instead of a simple IList, when I access a collection.

    Read the article

  • How to fine tune FluentNHibernate's auto mapper?

    - by Venemo
    Okay, so yesterday I managed to get the latest trunk builds of NHibernate and FluentNHibernate to work with my latest little project. (I'm working on a bug tracking application.) I created a nice data access layer using the Repository pattern. I decided that my entities are nothing special, and also that with the current maturity of ORMs, I don't want to hand-craft the database. So, I chose to use FluentNHibernate's auto mapping feature with NHibernate's "hbm2ddl.auto" property set to "create". It really works like a charm. I put the NHibernate configuration in my app domain's config file, set it up, and started playing with it. (For the time being, I created some unit tests only.) It created all tables in the database, and everything I need for it. It even mapped my many-to-many relationships correctly. However, there are a few small glitches: All of the columns created in the DB allow null. I understand that it can't predict which properties should allow null and which shouldn't, but at least I'd like to tell it that it should allow null only for those types for which null makes sense in .NET (eg. non-nullable value types shouldn't allow null). All of the nvarchar and varbinary columns it created, have a default length of 255. I would prefer to have them on max instead of that. Is there a way to tell the auto mapper about the two simple rules above? If the answer is no, will it work correctly if I modify the tables it created? (So, if I set some columns not to allow null, and change the allowed length for some other, will it correctly work with them?) EDIT: I managed to achieve the above by using Fluent NHibernate's convention API. Thanks to everyone who helped! However, there is one more thing: after checking out the convention API, I really would like my IDs to be calld "ID", not "Id", but it seems to me that the PrimaryKey.Name.Is(x => "ID") is not working at all. If I add it to the conventions collection and rewrite my entities' properties to "ID" instead of "Id", it throws an exception that there is no primary key mapped. Any thoughts on this?

    Read the article

  • Setting clustered index in nhibernate

    - by SolBadguy
    Hi. I'm trying to define a property that is not the id as a clustered index in nhibernate, yet I've found no way of doing this. Could anyone give me a pointer of how this is done, or it is something not currently available in nhibernate? Thanks in advance

    Read the article

  • Where is the api reference for nhibernate?

    - by Simon
    I may be going mental, but I can not find any api reference material for nhibernate. I've found plenty of manuals, tutorials, ebooks etc but no api reference. I saw the chm file on the nhibernate sourceforge page, but it doesn't seem to work on any of my PCs (different OSes) Can someone please point me in the right direction?

    Read the article

  • How to add a SaveOrUpdateCopy event listener in NHibernate

    - by skrishna
    How can I add a event listener for SaveOrUpdateCopy in NHibernate ? I see that the ListenerType enumeration does not have a 'SaveOrUpdateCopy' type. I tried using the 'Merge' type, but that adds it to the MergeEventListeners collection. The SaveOrUpdateCopy invokes the events from the SaveOrUpdateCopyEventListeners collection. How can I add my event class to the SaveOrUpdateCopyEventListeners collection in NHibernate? Any help is appreciated.

    Read the article

  • NHibernate Many-to-Many Mapping not working

    - by ClutchDude
    I have a Nhibernate mapping file for a simple user/role mapping. Here are the mapping files: Users.hbm.xml <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Sample.Persistence" namespace="Sample.Persistence.Model"> <class name="User" table="Users"> <id name="UserKey"> <generator class="identity"/> </id> <property name="UserName" column="UserName" type="String" /> <property name="Password" column="Password" type="Byte[]" /> <property name="FirstName" column="FirstName" type="String" /> <property name="LastName" column="LastName" type="String" /> <property name="Email" column="Email" type="String" /> <property name="Active" column="Active" type="Boolean" /> <property name="Locked" column="Locked" type="Boolean" /> <property name="LoginFailures" column="LoginFailures" type="int" /> <property name="LockoutDate" column="LockoutDate" type="DateTime" generated="insert" /> <property name="Expired" column="Expired" type="Boolean" generated="insert"/> <set name="Roles" table="UsersRolesBridge" lazy="false"> <key column="UserKey" /> <many-to-many class="Role" not-found="exception" column="RoleKey" /> </set> </class> </hibernate-mapping> Role.hbm.xml <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Sample.Persistence" namespace="Sample.Persistence.Model"> <class name="Role" table="Roles"> <id name="RoleKey"> <generator class="identity"/> </id> <property name="Name" column="Name" type="String" /> <set name="Users" inverse="true" atable="UsersRolesBridge" lazy="false" > <key column="RoleKey" /> <many-to-many class="User" column="UserKey" /> </set> </class> </hibernate-mapping> I am able to retrieve roles for each user via NHibernate but when I go to save a new object, the roles are not saved in the Bridge table. The user is created and insert with no issues. I've checked that the Role collection, a field on the user, is being populated with the proper rolekey before the Session.Save() is called. There is no exception thrown as well.

    Read the article

  • NHibernate Optimistic Concurrency

    - by initforthemoney
    I'm investigating optimistic concurrency in NHibernate. I have a scenario that is very similar to what is being described here: http://weblogs.asp.net/stefansedich/archive/2008/10/01/set-the-value-of-a-version-column-in-nhibernate-manually.aspx Would you recommend going with the proposed solution in this blog post? Thanks

    Read the article

  • Free NHibernate helper tools?

    - by Jason Baker
    Are there any free tools to help simplify working with an NHibernate project in .NET 3.5? Primarily, I'm looking for some kind of code and config file generator to automate some of the more tedious parts of working with NHibernate.

    Read the article

  • Nhibernate schema clasue

    - by Phil Whittaker
    How do I use the schema clause on a bag object in Nhibernate mapping? I have an table that I need to sepcify the schema for and the nhibernate documentation talks about table schema but I can't find any further details...

    Read the article

  • Is it possible to Load hbm.xml info at app startup instead of via an embedded resource?

    - by Daniel Auger
    All of the NHibernate examples I've see that use hbm files have the hbm.xml file set as an embedded resource with "do not copy" chosen in the file properties. This means that if a database column name were to change in production, the app would have to be recompiled with the changes in the hbm.xml file during build time. Is there any way to make NHibernate load the hbm.xml files from the file system at application startup instead of using an embedded version?

    Read the article

  • Nhibernate generate plain sql query instead of execution statement

    - by Wei Ma
    Using SQL profiler, I was able to find the query generated from Nhibernate was executed in the EXEC sp_executesql N'select ...' fashion. I am wondering if there is any way to force Nhibernate to generate the plain Select ... statement instead. The reason I want this is because apparently SQL Server generated different execution plans for them, and in my scenario, the plain "select ..." runs MUCH faster.

    Read the article

  • Setting up nHibernate with SQLite

    - by Goblin
    Does anyone have a step-by-step guide on how to use nHibernate and SQLite? I can't figure out which dll's I need and which goes in the references and which just need to be copied. I would also like to know how to create the actual file for SQLite. This is for a small application running .Net 4.0 - I understand some things have changed since 3.0 and NHibernate 1.2...

    Read the article

  • Why use Hibernate/nHibernate?

    - by ProgrammingPope
    I have found myself doing a lot of work to get nHibernate setup and am left wondering: Why use a framework like Hibernate/NHibernate? I am sure that quite a few people love the framework but I am unclear on the advantages and disadvantages. What are the advantages and disadvantages of lazy loading, and are there other features to Hibernate? Is there anything that makes a framework like this easier to use (best practices, other frameworks, etc)?

    Read the article

  • Retrieve all records in a table with nHibernate

    - by brainimus
    I need to retrieve all the records in a table with nHibernate. If I had the key for all the records in the table I could loop and use nHibernate's Get method (this seems inefficient though) but I don't have the keys. I could also use FindAll but this requires criteria or a stored procedure. How can I get all the records from the table?

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >