How do I secure my "hibernate.cfg.xml" file? (Nhibernate)
How do I secure my "hibernate.cfg.xml" file? (Nhibernate). It currently sits in the route of the web app and can be viewed via the browser. ...
How do I secure my "hibernate.cfg.xml" file? (Nhibernate). It currently sits in the route of the web app and can be viewed via the browser. ...
I have configured NHibernate to output the SQL it generates to the console. I have added the following to the app.config of the DLL containing the integration tests I want to run from NUnit: <configSections> <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.0.0, Culture=neutral, Pub...
I have the following hql. This works fine if i don't try and include the "OrderItem" entity. I understand that there is no "on" clause in hql. What is the best way to join orderItem var hql = new StringBuilder(); hql.Append( @"select p.Id, p.Name, p.Description, p.ProductKey, p.CustomerSku, p.ImageUrl, p.ImageThumbUrl, p.Ima...
I've been using the IPreUpdateEventListener for auditing entities, in particular using the FindDirty method to find the changed properties: public bool OnPreUpdate(PreUpdateEvent updateEvent) { int[] dirtyFieldIndices = updateEvent.Persister.FindDirty(updateEvent.State, updateEvent.OldState, updateEvent.Entity, updateEvent.Session)...
I have a table logging web page hits. Something like: {VisitId, VisitorId, Url, Date} (The visitor ID is a GUID stored in a cookie) I would like to create a Visitor object that has a collection of Visit objects. class Visitor { public virtual Guid VisitorId { get; set; } public virtual IList<Visit> Visits { get; set; } } Rather t...
Not completely sure about this just yet, but when we save an entity over NHibernate that includes a field value of NULL for a column that is NOT NULL (but has a DEFAULT value), the operation fails. We tried out the same schema by throwing an INSERT statement on it, completely leaving out the NOT NULL field (as opposed to explicitly decl...
Possible Duplicate: What is NHibernate? I've heard the name NHibernate used a lot, but I don't really understand what it is. I've read the Wikipedia article, but I don't understand how using NHibernate in my C# applications (desktop w/ WPF, web w/ ASP.NET MVC) will: Change the code Be easier/faster Should I look into using...
I have two Classes. "Product" and Product can have a number of objects of class "Attribute" When someone edits the "Product" I would like to delete all Attributes associated with that product and recreate the new ones (second part works fine) but I'm getting a error which stops me removing the attributes. public ProductMapping() {...
I have a SQL Server database that contains an xml column. I need to map that xml column to an expando object within my domain entity. I am using NHibernate. How do I extend NHibernate to accommodate this? I am assuming (I am new to NHibernate) that I have to override the implementation to get and set the xml data, but I don't know ho...
I'm a newbie to nHibernate, and Fluent nHibernate, and I'm having a great deal of trouble with some simple setup on something. private static ISessionFactory CreateSessionFactory() { return FluentNHibernate.Cfg.Fluently.Configure() .Database( FluentNHibernate.Cfg.Db.MsSqlConfiguration.MsSql2008 ...
I'm writing a web app using ASP.NET MVC 2 and picked NHibernate as my ORM. I basically learned my basics from watching the Summer of NHibernate series, and have adopted the authors session per request strategy for managing a session (Ep 13). Things seem to work well, but I'm concerned about whether this is a functional real world appro...
Hi all, I'm coming from a php world and am now initaiting a project in .NET environment. After looking around, I noticed that the combination of MVC, spring.net and NHibernate might work for me. In PHP I created applications using Symfony (with propel or doctrine) that combined all these in one framework. The Jobeet tutorial ( http://...
Hello. My schema looks like this: The Message.Id column is an identity(1,1), and the MessageHeader table uses a composite key consisting of the associated message ID, and a header name field that uniquely identifies a header within each message. Entities are represented in code as: public class Message { public virtual int Id {...
Hi simply I have an Employee class and Department class and the employee must be in a department, when I save the Employee I want to save the selected department also. any one have a code sample or any solution. ...
I want to extend the default LINQ provider for NHibernate 3 with methods of my own. I want to be able to use some methods from my POCOs. I have a component named Range which is used quite often in many of my POCOs. This nhibernate component class has a method Contains(int value) that I want to use in LINQ query expressions Mapping: <cl...
Hi We have a large management application and we do alot of logging for every action, who did what and at what time. However we have more and more automatic systems which we would like to differentiate aswell. In all our tables we have a column called PerformedBy which is an int. This has always been a reference to a Table called Emplo...
I have two HQL queries I am using for a quick-and-dirty unit test. The first looks somewhat like this: from Foo where SOME_FOREIGN_KEY = 42 The second looks like this: from Foo as foo inner join foo.Bar as bar where foo.SOME_FOREIGN_KEY = 42 The SOME_FOREIGN_KEY column is not the name of something that Hibernate knows is mapped. ...
Consider following LINQ-to-NHibernate queries: var q1 = from se in query.ToList<SomeEntity>() where prop1 == "abc" select se; var q2 = from se in q1 where m1(se.prop2) == "def" select se; q2 will not work with error: "The method m1 is not implemented". But when replace q2 with following query, everything goes ok: var q...
Hello Guys, I'm developing an application with nHibernate and MySQL. I have a HQL command that runs every second, and in this command I do a "Inner Join Fetch", like this: "from Order o inner join fetch o.Customer order by o.Date" It's work fine but It fill all properties of "Customer", and I have a lot of columns in DataBase (al...
I want to execute the following SQL select count(*) as myCount from user group by name; I came up with the following criteria for the same DetachedCriteria.ForClass(typeof(UserDTO)) .setProjections(Projections.ProjectionList() .Add(Projections.rowCount(),"myCount") .Add(Projections....