Hi all,
I have a class called User. User can have one or more roles, defined in an bitmask enum. The user has a Role property that i can use via:
user.Roles = Roles.User | Roles.Other;
In the database I have a Users table and a User_Roles table. For every role that a user has, i want to store it in the Users_Roles table with the Use...
Hello guys.
I've used Fluent NH in some projects but I'm having some problems with using the PersistenceSpecification class for testing a collection mapping. Here's the code for my classes (I'm just putting here the collection definition):
public class Ocorrencia : EntityWithAction, IHasAssignedId<Int32> {
private IList<Interve...
Database Strucutre:
Shows
ID
Name
Genres
ID
Name
ShowsGenres
ShowsID
GenresID
Above is my Database I am trying to figure out how to map this properly. My Show object is like this:
public class Show
{
public virtual int ID { get; set; }
public virtual string Name { get; set; }
public virtual IList<Genre> Genres { get; se...
I have a database table with Sqlite structure:
CREATE TABLE Cashflows
(
Id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
Fund_Id INTEGER NOT NULL,
CashflowDate DATETIME NOT NULL,
CashflowType INTEGER NOT NULL,
CashflowValue DOUBLE NOT NULL
);
Fund_Id is just a standard reference to the Fund table.
In Fluent NHiberna...
Hi,
I'm trying to map the following tables/entities in FNH and seem to be getting nowhere fast!
**Tables**
Contacts
ID (PK - int - generated)
...
PhoneTypes
ID (PK - varchar - assigned) (e.g. MOBILE, FAX)
ContactPhones
ContactRefId (PK - FK to Contacts)
PhoneTypeRefId (PK - FK to PhoneTypes)
...
(I should...
Hi I am writing unit tests for fluent Nhibernate, when I run the test in isloation it passes, but when I run multiple tests. or run the test more than once it starts failing with the message below System.ApplicationException : For property 'Id' expected '1' of type 'System.Int32' but got '2' of type 'System.Int32'
[TextFixture] public v...
hello, i have my server written with structure map and fluent nhibernate,
when i run my server from my pc and direct him to the db on another server i get a sqlexception that tells me that the timeout expired
this is the message :
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not resp...
I have a legacy schema that contains tables with composite keys where some of the keys are of type binary(16) -- its a MD5 hash of the other columns. I am having trouble finding the right way to map this structure. The first thing I tried was to simply use byte[] as my domain type, which NHibernate quickly dismissed since byte[] does not...
I've been trying to wrap my head around subclasses and joined subclasses in Fluent nHibernate for a few days now without making any sort of headway. I've looked at the wiki but it doesn't seem to give me enough information, and googling returns me old results that uses depreciated code or are seemingly unrelated.
I just want a simple...
I am new to NHibernate.
I am using following property elements in my hbm file...
<property name="CountryId" length="4" />
<property name="CountryForCustomer"
formula="(SELECT *
FROM SystemCountry
WHERE SystemCountry.CountryId = CountryId)" />
Here I am trying to g...
I would like to have a structure like this:
Mapping class
int ID {get;set;}
IList<KeyValuePair<string,string>> Criteria {get;set;}
Criteria class
int ID {get;set;}
int MappingID {get;set;}
string FirstCriterion {get;set;}
string SecondCriterion {get;set;}
(int index {get;set;})
How can I get this keyvaluepair mapped?
I tried with Ha...
I'm working on tests for my Fluent NHibernate mappings, and my question is - is it a good idea to test for id value if Id column is represented by identity in Sql Server? Since it changes after each insert, how can I possibly do it?
new PersistenceSpecification<Product>(session)
.CheckProperty(p => p.Id, 1)
...
I have a database that I'm running several applications from. I like to separate the tables by creating a schema for each application. For my newest application I'm using FluentNHibernate. Seems like I have most of the plumbing correct but when I try to query one of my tables it can not find my table. I ran query analyzer and saw the sch...
Hi, I am trying to map my collections with FNHib automapping. The problems that I want to solve are:
1) I want all my collections in the project to be mapped via private field. How can I say that globally?
2) Is there any way to automap bidirectional relationship without explicitly overriding each of my entities.
class OrganizationEnt...
I have following query in NHibernate where the result is a list of DTO's, not entities:
var result = query
//.SetCacheable(true)
.SetResultTransformer(new MyDTOTransformer())
.List<DTO>();
This works with SetCacheable in comment but it throws an IndexOutOfBoundsException when I set SetCa...
I'm trying to follow this tutorial but instead of generating the expected hbm.xml files with my mappings in it generates simple .cs class for my entities like for example:
public class ProductMap : ClassMap<Product>
But I already defined those myself in code. I'm after the .hbm.xml which I can use in standard NHibernate at this time.
...
I've been using c# for the past year and I enjoy the power you get with Fluent NHibernate. One question that I get from friends is "nice but how can vb.net programmers use this?"
So for example- the below is a c# mapping class. How would someone do this with vb.net?
public class PostMap : ClassMap<post>
{
public PostMap()
{
Table("Po...
I want to be able to create a parent object with children and let the parent handle the update, saves and deletes.
My map classes.
ParentMap
Id(x => x.Id, "ID").GeneratedBy.Identity();
Map(x => x.Name);
HasMany(x => x.Children)
.KeyColumn("ParentID")
.Inverse()
....
I think I'm misunderstanding something about how this works. This is my fluent mapping:
public class FunctionInfoMap : ClassMap<FunctionInfo>
{
public FunctionInfoMap()
{
Id(x => x.Id);
Map(x => x.Name);
Map(x => x.Signature);
Map(x => x.IsNative);
Map(x => x.ClassId);
References(x => x.Class, "ClassId");
HasMa...
hi there,
i've been working with fluent nhibernate for a couple of months and i think it's a very flexible tool (even if 'tool' is maybe incorrect term) :)
i've to work on a new project and i'm still considering using fluent nhibernate solution to map my db on a repository layer. The matter is that, for some reason i really don't unders...