Hi everyone,
I was trying to change a convention so that my IDs follow this simple rule: ProductCode, CustomerCode, OrderCode etc etc.
I've found a simple way to do that adding a convention:
public class PrimaryKeyNameConvention : IIdConvention
{
public void Apply(FluentNHibernate.Conventions.Instances.IIdentityInst...
Here is the basic situation. In our application, we have Roles and Permissions. There is a many-to-many relationship between roles and permission. The catch is, that a user can be assigned roles directly, or they can have a role that they have acquired by paying for a service. To make things more interesting, if the user cancels the ...
I'm looking forward to generate our database script by using the script generated by nHibernate. We use Fluent nHibernate to create our mapping.
In our original database design, there is a few xml columns that use the following schema:
CREATE XML SCHEMA COLLECTION LocalizedValue AS
N'<xs:schema attributeFormDefault="unqualified" eleme...
If you have a PK Column that is not generated in any way how is it mapped?
I assumed it would be something like:
Id(x => x.PKId).Column("PKId");
But I keep getting a:
Cannot insert the value NULL into column 'PKId', table 'X.dbo.DBTable; column does not allow nulls. INSERT fails.
...
I got a polymorphic relationship like the following example:
public class A
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
}
Class B & C contining a List of A's:
public class B/C
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual IList<A>...
Hello,
I worked through the Fluent NHibernate tutorial at http://wiki.fluentnhibernate.org/Getting_started and the project compiles fine.
However, I am getting a runtime error and I can't seem to resolve it. The error is happening in the CreateSessionFactory method you can see in the tutorial. Here it is:
private static ISession...
Is it possible to execute a statement like this in NHibernate?
SELECT * FROM
mytable
WHERE
field2 = "word"
OR
MATCH (field1) AGAINTS ('wordA' IN BOOLEAN MODE)
...
Hi, at first i'm really new to ORM, nhibernate and FHN. i look into this stuff for a few days now.
i have an existing database with 4 tables:
so i tried first to get the Auswahl and RefAuswahlFilter to work.
here are my DomainObjects: pls let me know when i can do this better
[Serializable]
public class Auswahl
{
public Auswahl...
When using Fluent NHinbernate How do I make a PK Read only I tried to make it internal on the setter but I get this:
---->
NHibernate.InvalidProxyTypeException :
The following types may not be used as
proxies: Domain.Address: method
set_AddressId should be
'public/protected virtual' or
'protected internal virtual'
my ma...
Where should I put my NHibernate SchemaExport method and how should I call it when I decide to recreate the database?
Should I leave this in my startup project (an asp.net mvc project)? Should I create a seperate console project just for exporting my schema?
I think these questions all originate from the fact that I don't want schema...
I've been using S#arp and have updated the Generate method in AutoPersistenceModelGenerator to work with Fluent NHibernate 1.1. I also changed its assembly name from MyProject.Data to MyProject.Infrastructure and I'm not sure which has caused the problem:
public AutoPersistenceModel Generate()
{
return AutoMap.Assemblies...
I have the following class which I am mapping using Fluent NHibernate's AutoMapper. I do not want the list items publically modifiable so have a public IEnumerable backed by an IList which can be populated internally or by NHibernate.
I want NHibernate to map teamMembers to a column named TeamMembers. I also want FNH to ignore the TeamM...
I have the following tables and i have no control on the table schema
DocumentText
{
NoteId
OutputType
Note_Text
}
OrderCoordinator
{
AuthoriserCode
Value
}
DocumentText joined to OrderCoordinator on (Note_Text = AuthoriserCode)
only when Outputtype='PRTYPE'
How do i map this using fluent nhibernate
i am currently mapping ...
Hi everybody.
Just a short question: How do I configure the many-to-one attribute "lazy" to the value "no-proxy" (as mentioned here here ) in Fluent Nhibernate?
...
Hi guys,
I have got an abstract base class and inherited poco entities. I am using table per subclass inheritance with fluent nhibernate 1.1 automapping.
The class inheritance looks like follows
Node (abstract class)
Place : Node
Asset : Node
Node class is basically a tree structure.
public abstract class Node
{
publi...
I'm needing to foray into EF4 for the first time since experiencing the disappointment that was v1. Since then I've been a happy nHibernate user but I'm needing to pick EF back up now for a new project due to client preference.
Has anyone created a quick guide of analogies between ORM concepts for the two? If I had a translation of nH...
I currently have a bookings model such as:
public class RoomBooking : Entity, IBooking
{
public virtual Client Client { get; set; }
public virtual Address Address { get; set; }
public virtual IList<BookingPeriod> BookingPeriods{get;set;}...
public class BookingPeriod : Entity
{
public virtual IEnumerable<IBooking> Book...
Where can I get the current Linq provider for NHibernate? I am also using the current release of Fluent NHibernate (1.1). Will the current Linq provider (once I find it) play nicely with fluent?
...
I am trying to map an enum property (instance of System.DayOfWeek) in my model to an integer database field.
Other enum properties in the model should be mapped to strings, so I don't wish to define a convention.
I understand that this should be possible using a fluent mapping like:
Map(x => x.DayOfWeek).CustomType<int>();
and indeed...
using fluent nhibernate, and automappings (nhibernate creates my db schema), how can i get nhibernate to create a nvarchar(max) column in the database based on the following class
public class VirtualPage : BaseEntity
{
public virtual int ParentId { get; set; }
public virtual string PageName { get; set; }
public virtual stri...