I want to have a class that defines my parameter data for a stored procedure. It's going to be a very simple object:
public class MyQueryData : SprocObjectBase
{
public int Value1 { get; set; }
public string Value2 { get; set; }
public bool Value3 { get; set; }
...
}
It will inherit from a base class with shared values, like...
Hello Everyone,
I have a Sponsor object which has a collection that looks like this...
public virtual IDictionary<SettingId, object> SettingValueDefaults { get; set; }
These are actually being pulled as a subset of a larger table. I need to be able to read from these, and that is working correctly.
However, I would like to be able...
I've got the following mapping in my application. The mapping is generated, by a custom tool. Other mappings generated work ok, but this one is giving me a strange error which I don't understand.
This is the mapping;
<?xml version="1.0" encoding="utf-8"?>
<!--Generated by NHibernate.Mapping.Attributes on 2010-10-29 08:39:48Z.-->
<hiber...
Hello everybody
I have the following code
factory = new Configuration().Configure().BuildSessionFactory();
session = factory.OpenSession();
var query = session.Linq<Root>();
var data = query.ToList<Root>();
var data2 = query.ToList<Root>();
This one generate 2 SQL queries, so i understand that first level cache isn't working.
Does LI...
This sounds like such a dumb question but I've spent too long looking for the 'Restrictions' object when attempting something like this...
Objects objs = NHibernateSession.CreateCriteria(typeof(Objects ))
.Add(Restrictions.Eq("ObjectName", objName))
I'm using nHibernate 2.2 I believe and have added references nHibe...
I wonder if this is possible with any Nhibernate version.
I have a class A with a property of class B connected by a lazy many-to-one relation. I'd like to get A.B.Id without going to the database (I mean, without getting the whole B entity).
Is this possible?
Thanks!
...
I have entities:
public class Document : PersistentObjectBase
{
public virtual long? FolderId
{
get;
set;
}
}
<id name="Id" column="ID">
<generator class="identity" />
</id>
<version column="VERSION" name="Version" type="Int64" unsaved-value="undefined" />
<property name="FolderId" column="FOLDER" />
...
Normally, when you define a mapping for a certain property of a class, NHibernate saves the value in the property as soon as it has been fetched. Either it's fetched immediately when getting the object, or it's lazily loaded on the first invoke of the getter of the property, but once it has been loaded from the database it's fetched.
Pl...
My current project is using NHibernate 3.0b1 and the NHibernate.Linq.Query<T>() API. I'm pretty fluent in LINQ, but I have absolutely no experience with HQL or the ICriteria API. One of my queries isn't supported by the IQueryable API, so I presume I need to use one of the previous APIs -- but I have no idea where to start.
I've tried s...
I am checking if I can use Entity Framework or NHibernate to build a conceptual model where fields of some classes are mapped from different physical data sources.
EF looks promising, at least on paper: this blog post mentions that "you can mix and match a number of different database vendors, application servers or protocols to design ...
Is this possible to use let keyword with nhibernate linq?
I wrote
posts = from post in postsRepository.GetPosts(name)
let commentsCount = (from c in NHUnitOfWork.CurrentSession.Linq<Comment>()
where c.Post.ID == post.ID
select c).Count()
select new ...
and in r...
I am using Nhibernate (I am a complete noob), and what I want to be able to do is copy an entity that is loaded from the database and save it with a new Id... has anyone run into this situation? Any help would be very appreciated.
...
I am going to make a smaller website in MVC.NET, mostly to learn how to work with the MVC.NET framework. I can't decide if I should use NHibernate or Linq2Sql as my Data Access Layer. Linq2Sql would much easier and faster to setup, but it doesn't have the capabilities as NHibernate (2 layer caching etc.).
So would it be wiser to use mor...
We are using Nhibernate to connect to DB2 database. From my C# application.
We are able to connect using Odbc and OleDB driver but we need to connect using IBM DB2 driver (IBM.Data.DB2.dll).
We are not able to connect using it. We are getting below error seems NHibernate is not able to create NHibernate.Driver.DB2Driver.
{"Could not ...
Hello ,
I have already read other SO posts dealing with similar but none clarified what I wanted to do.
I have MyProduct Entity and MyItem Entity. Product is made up of MyItem(s) .same like order order line scenario.
MyProduct Will need to have value objects
public class Item : EntityBase
{
public Item()
{
}
publ...
I'm new to NHibernate so I'm sure that I'm just missing something fundamental.
I have an table called Issue that has a ParentId column. The ParentId can refer to different tables (i.e. - Project or Customer, etc.) How can I do that query in NHibernate so that I can show only the Issues that belong to Project. Here is what I've tried....
How can I iterate throw mapped entities and get all data from database? I dont know on first place what is mapped by NHibernate...
Configuration configuration = SessionProvider.Configuration;
var mappedClasses = configuration.ClassMappings;
IRepository repository = new Repository();
foreach (var mappedClass in mappedClasses)
{
var...
I have many to many relation between Posts and Tags tables.
Using HQL I want to get only a few fields from Posts table and names of the tags.
So I wrote:
select p.field1, p.field2, count(distinct p.field3), t.Name
from Post p
left join p.Tags t
group by p.field1, p.field2, t.Name
I want to have post data and list of its tags.
Result ...
I just started with NHibernate, created my mappings using fluent NHibernate as follows:
public class CustomerMap : ClassMap<Customer>
{
public CustomerMap()
{
Id(x => x._id, "Id");
Map(x => x._KdNr, "KdNr");
Map(x => x._Name, "Name");
HasMany(x => x._Contact)
.Table("Contacts")
...
I have been starting to follow the example on http://www.sharparchitecture.net on how to create a site using MVC.NET and NHibernate. I have gotten T4 to generate a object called Author for me, and validate it at the database.
I would like to create an object e.g. Book, but I can't however find any information on how I can create a man...