I am using my fluent nhibernate mappings to generate my MS SQL Server database.
I would like to be able to set a columns' description as part of this generation.
...
Hi,
Does anyone know how can we automatically map dynamic components using Fluent Automapping in NHibernate?
I know that we can map normal classes as components, but couldn't figure out how to map dictionaries as dynamic-components using fluent automapping.
Thanks
...
Any 1-M that use the primary key of the parent table, but any 1-M that uses a different column does not work. It generates the SQL correctly, but put the value of the key into the SQL instead of the column value I want.
Example mapping:
public TemplateMap()
{
Table("IMPORT");
LazyLoad();
Id(x => x.Imp...
I am using Fluent NHibernate's (1.0 RTM) automapping feature to create my oracle database schema. My issue is that all the tables are using a single "hibernate-sequence", whereas I would prefer (and my boss would demand) a sequence generator for each table.
Any ideas?
...
Not sure where to start, but I had gotten the most recent version of NHibernate, successfully mapped the most simple of business objects, etc. When trying to move to FluentNHibernate and do the same thing, I got this error message on build:
"System.IO.FileLoadException: Could
not load file or assembly 'NHibernate,
Version=2.1.0.4...
I'm attempting to do the most simple of mappings with FluentNHibernate & Sql2005. Basically, I have a database table called "sv_Categories". I'd like to add a category, setting the ID automatically, and adding the userid and title supplied.
Database table layout:
CategoryID -- int -- not-null, primary key, auto-incrementing
UserID --...
I'm experimenting with converting my NHibernate mapping files to FluentNHibernate. However, I'm already stuck on my first attempt. Here's a fragment of one XML mapping file:
<class name="Contact" table="tblXContacts">
<id name="_id" column="ContactID" unsaved-value="0" access="field">
<generator class="identit...
I have the following entity
public class Employee
{
public virtual int Id {get;set;}
public virtual ISet<Hour> XboxBreakHours{get;set}
public virtual ISet<Hour> CoffeeBreakHours {get;set}
}
public class Hour
{
public DateTime Time {get;set;}
}
(What I want to do here is store information that employee A plays Xbox everyda...
I have a class whose primary key is a single column, which is a reference to another object's single column primary key. The only way I can see to map this in NHibernate is to pretend it's a composite key (even though it's a single column key) and use the key-reference mapping. Is there a more appropriate way?
Snippet below:
class Comp...
I have a child object in the database that looks like this:
CREATE TABLE Child
(
ChildId uniqueidentifier not null,
ParentId uniqueidentifier not null
)
An then I have a parent like so.
CREATE TABLE Parent
(
ParentId uniqueidentifier not null
)
Now, the problem is that in my Parent class, I have
public virtual Child Child { get;...
I'm using a legacy database that was 'future proofed' to keep track of historical changes. It turns out this feature is never used so I want to map the tables into a single entity.
My tables are:
CodesHistory (CodesHistoryID (pk), CodeID (fk), Text)
Codes (CodeID (pk), CodeName)
To add an additional level of complexity, these table...
I am very new to Fluent NHibernate and I have a problem that I cant find the answer to.
I have a string column in my database table, containing a mathematical expression i.e: "10 + 15 * 5". On my entity I have a property that I call Formula and this returns a class that contains the mathematical "formula" (not as a string).
I beleive t...
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...
Very close to what I'm trying to do but not quite the answer I think I'm looking for:
How to map IDictionary<string, Entity> in Fluent NHibernate
I'm trying to implement an IDictionary<String, IList<MyEntity>>and map this collection to the database using NHibernate. I do understand that you cannot map collections of collections directl...
Hi there!
In my project I am using NHibernate/FluentNHibernate, and I am working with two entities, contracts and services.
This is my contract type:
[Serializable]
public partial class TTLCContract
{
public virtual long? Id { get; set; }
// other properties here
public virtual Iesi.Collections.Generic.ISet<TTLCService> Se...
Noob question.
I have this situation where I have these objects:
class Address
{
string Street;
string City;
...
}
class User
{
string UserID;
Address BillingAddress;
Address MailingAddress;
...
}
What is the proper way of storing this data using (fluent) nHibernate? I could use a separate Address table an...
I have a few classes that read from very delicate tables, which is why I want them to be used by NHibernate as "ReadOnly". Establishing .ReadOnly() on each field map is really sloppy, and I'm not sure I trust it. How do I setup a class to be entirely readonly, as I can easily do with traditional XML mappings?
Edit: The answer does work....
I know this has been asked several times and I have read all the posts as well but they all are very old. And considering there have been advancements in versions and releases, I am hoping there might be fresh views.
We are building a new application on ASP.NET MVC and need to finalize on an ORM tool. We have never used ORM before and h...
Hi all,
I'm new to Fluent NHibernate and I'm running into a problem.
I have a mapping defined as follows:
public PersonMapping()
{
Id(p => p.Id).GeneratedBy.HiLo("1000");
Map(p => p.FirstName).Not.Nullable().Length(50);
Map(p => p.MiddleInitial).Nullable().Length(1);
Map(p => p.LastName).Not.Null...
Hello,
I am changing my application to use Fluent NHibernate. I have created my Fluent mapping files and have now moved onto configuring my Session Manager. Currently, I use the following code -
private ISessionFactory GetSessionFactory()
{
return (new Configuration()).Configure().BuildSessionFactory();
}
Along with my hiberna...