Hi, my application has the following entities:
public class User
{
public virtual int UserID { get; set; }
public virtual string UserName { get; set; }
public virtual IList<UserLog> Log { get; private set; }
public User()
{
Log = new List<UserLog>();
}
}
public class UserLog
{
public virtual int Use...
Hi everyone,
I have a simple ASP.NET MVC web application that uses NHibernate with FluentNHibernate's auto mapping feature for its data access. I have encountered a scenario in which I would like NHibernate to persist some classes as binary data.
For example, I have something similar to this:
public class User
{
...
// This f...
Is there a way to get a list of ids that are scheduled for deletion in IOneShotDeleteHandler, maybe from session.Statistics?
...
I have the following method:
var catIds = DetachedCriteria.For<Category>()
.Add<Category>(c => c.TypeCode == "IMA")
.SetProjection(LambdaProjection.Property<Category>(s => s.Id));
This is returning nothing because in the database the field is nchar(10). I want to Trim() the TypeCode value, as follows:
...
How do I navigate meta data to find out what are all types that are related to the entity and the type of the relationship?
...
I have the following entities
public class Client
{
public virtual int Id{get;set;}
public virtual IList<Telephone> Telephones { get; private set; }
}
public class User
{
public virtual int Id{get;set;}
public virtual IList<Telephone> Telephones { get; private set; }
}
public class Telephone
{
public virtual int Id...
Im not so sure if this is a problem with nihibernate or linq(i would assume more linq but i may be wrong)
I Have website about boxing.
There are three tables in this example
Boxer (BoxerId among other properties)
Boxer_Match (holds a boxerId and MatchId - which is a composite key)
Match (MatchId among other properties)
Now currently i...
I am writing a framework for a rewrite of an existing application. We have a data model of around 900 tables with 11000 fields in total and databases approaching 120 GB in the field. The basic elements of my new implementation are WPF, NHibernate 3, C#, .NET 4.0, NHibernate.Validator and Spring. The application itself is very data/transa...
I have a scenario that I commonly run into. It's simple to do with a
standard ADO Transaction, but not so much with NH (that I know of).
I have 2 tables to update. The first contains profile information
(Profile) and the other (Work) contains records changes that need to
be made and the status of those changes. For each update to the...
I have two entities, a Shelf and a Product:
public class Shelf
{
public virtual IList<Product> Products { get; set; }
public Shelf()
{
Products = new List<Product>();
}
}
public class Product
{
public virtual string Name { get; set; }
}
Basically put, a Shelf can contain many Products, and a Product can b...
I have a [ContactNumbers] table as defined below:
ID (PK) | PersonID (FK) | NumberType | Number
========|===============|============|=======
and a classes defined as:
public class Person
{
ContactNumber homePhone;
ContactNumber workPhone;
}
public class ContactNumber
{
string Number;
}
How would I define my HBM mappin...
My main entity (Account) graph looks like the following:
Account
Manager
SalesPerson
Trader
The Manager, SalesPerson and Trader entity are of type person. Now while creating the main entity (along with inner entities) I need to create a new Person if it doesnt already exist. This introduces a problem, where in if the same (...
Hello,
I'm working with nHibernate.
I have make an Assembly (ex : DAL.dll), which contains the mapping files (.hbm.xml) and the entities (.cs). This Assembly has a strong name (signed).
I created a console project, which reference the DAL assembly (DAL.dll).
When I try to instanciate the Configuration, it fails when loading my DAL As...
I don't think this is possible but here goes...
I want to add method that can handle n numer of generics. for example :
bool<T> MyMethod() where T: Isomething
{
}
will work for one type
bool<T,K> MyMethod() where T: Isomething
{
}
will work for two types
Is there a way to work with n types - e.g.
bool<T[]> MyMethod() where T: ...
I'm using Fluent NHibernate and the setup I have is as follows:
An Address object, which is a simple list of address fields.
A Company object which has two references to address objects, MainAddress, InvoiceAddress.
The problem I'm having is that on occasion both MainAddress and InvoiceAddress may refer to the same record in the Addre...
I know its possible to generate the database tables from the domain model. But is there any way of doing things the other way. I have a totally awful database (worst I have ever seen). Its sharded (16 Shards!!), split across multiple postgres databases (all on the same server) with foreign key relations like urn:dbtable:guid.
Its pro...
OK, first my simple Domain Model is 2 classes with a one-to-many relationship, a simple Parent -> child relationship. A 'Tweet' has one or more 'Votes', but each Vote belongs to just one Tweets etc.
public class Tweet
{
public virtual long Id { get; set; }
public virtual string Username { get; set; }
public virtual string Me...
I have just converted my application from LINQ2SQL to NHibernate and I'm trying to figure out how to optimise the following example. I tried using the .Future method but when my session closes the view then tries to fetch the data and I get a session closed error.
Does anyone know any best practises for this kind of thing? I have a lot ...
How do you tell NHibernate to ignore persisting a child object? I have my my mapping set up so a Person has an address so when I attempt to persist Person without an address or with a new address then gives a flushing error. Now I know I can Cascade, but is it possible to tell NHibnerate not to worry about the address?
...
So for a project that we are working on we have our entire domain model mapped using mapping-attributes on the business entities themselves. I have a working sql-query mapping that I would like to define using the mapping-attributes but I am not sure how to do this. Any help is appreciated.
Here is the xml mapping that needs to be trans...