Hello guys.
I've used Fluent NH in my project but I'm having some problems with using the Collection class. Here's the code for my classes
public class Vendor
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual Services Services { get; set; }
}
public class Services : I...
i want to convert this mapping file from NHibernate to Fluent NHibernate
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="CustomCollectionsBasic.Core.Category, CustomCollectionsBasic.Core" table="Categories">
<id name="ID" column="CategoryID" unsaved-value="0">
<generator class="identity" /...
Hi I am attempting to use Castle windsor Nhibernate Facility with fluent Nhibernate and Im getting the error above, as far as Im aware , I have followed the instructions on setting this up. Has anyone else seen this issue and maybe offer some advice? Thanks
Value cannot be null.
Parameter name: classType
Description: An unhandled except...
Hi Iam having some trouble getting castle Nhibernate facility up and running properly. This error I guess makes sense because the Nhbernate repository constructor takes in an ISessionManager as a constructor argument, my question is does castle not inject this dependency? or is there something wrong with my configuration
UserServiceTest...
I'm trying to fluently configure a SessionFactory to access an Oracle9i database, using ODP.Net, and I'm getting this MissingConstructorException. I've got the actual fluent mappings sorted out ok, but I'm not sure what else it is that I've done wrong.
Here is the exception:
BasicConnectionTests.AssertThatWeCanConnectToADatabase :
F...
Hello all,
I'm using FluentNHibernate and Linq To Nhibernate, with these entities (only the relevant parts):
public class Player : BaseEntity<Player>
{
private readonly IList<PlayerInTeam> allTeams = new List<PlayerInTeam>();
public IEnumerable<Team> Teams
{
get
{
return from playerInTeam in all...
Hey!
I am using Nhibernate with Fluent, to persist a SQL Server 2008 express database in a business application.
I have a class named Receipt which contains a list with many objects named ReceiptItems.
The user can create a receipt, add Receiptitems to it, and edit it as long as its not marked Finished.
This part works well and saves t...
Hi,
I'm trying to update the data in the parent table that is referenced in the child table from the child's view in Asp.net.
I mapped the tables using Fluent Nhibernate.
In the child table, the mapping looks like this:
public class ChildMap: ClassMap<Child>
{
public ChildMap()
{
Id(i => i.childID).Not.Nullable();
...
(Edited to avoid leading down the wrong road)
Before giving details, very short version: I have a SQL statement I need to get out of NHibernate, and I have Criteria API statements that give it to me. The NHibernate is trying to do something wrong with the statement it generates, and I'm trying to figure out why.
I have the following m...
ok, I have difficult time with automapping collections using fluent nhibernate. This time I tried to apply a collection convention which simply says to use camelCaseField with underscore. Well I got the convention loaded and I hit the breakpoint in the method below FNH still produces strange mapping. What I am doing wrong?
public class ...
Suppose you have sets of Fluent conventions that apply to specific groups of mappings, but not to all of them.
My thought here was, I'll create custom C# attributes that I can apply to the Fluent *Map classes - and write conventions that determine acceptance by inspecting the *Map class to see if the custom attribute was applied.
That ...
I have an NHibernate configuration file as follows:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
<session-factory name="MyProject">
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.provider">NHibernate.Connection.D...
If in my classmap I have
SchemaAction.None();
and if I also have
.ExposeConfiguration(cfg =>
{
new SchemaExport(cfg)
.Create(false, false);
})
Can I ensure that nhib will not touch the db schema in any fashion.
In other words the only write action will be that of entitie...
I have a product table that has a many-to-many relation to itself (using a two-column many-to-many table) and I have set it up in Fluent NHibernate with the following code:
public class ProductConfiguration : ClassMap<Product>
{
public ProductConfiguration()
{
Table("Product");
Id(p => p.Id).GeneratedBy.Guid();
...
Hello,
Currently I am using many-to-one element in hbm file to fetch the data object from database like following....
<property name="ContactId" length="4" />
<many-to-one
name="DefaultContact"
column="ContactId"
class="Models.Contact"
update="false"
insert="false"/>
This code is fetching the data properly, but no...
Hello,
It is of a newby question, so sorry in advance.
I'm using fluent NHibernate and get a strange behavior on it.
I have two classes that look like that (simplified) :
public class Group
{
public virtual int Id{get;protected set;}
public virtual String Name{get;set;}
public virtual List<Person> Persons {get; protected ...
Given the following class:
class XMap : ClassMap<X>
{
HasMany(x => x.ListOfY);
HasManyToMany(x => x.ListOfZ);
}
I need a way to read these mappings. Is there a way to detect these? I need something like:
XMap map = new XMap();
var t = GetMappingType(map, "ListOfY"); // somehow returns many-to-one
var t = GetMappingType(map, "...
We have an Enrollment object that has a Student object and the Student object has many Enrollment objects. If I leave off the Cascade.SaveUpdate() from the Enrollment's Student reference, updates to the Student table do not execute, but updates to the Enrollment object succeed. But if I add the Cascade.SaveUpdate() on the Enrollment's ...
I'm doing a simple query on the database, a search on two columns. I have an index on the columns. When I do the search in SQL Server Management Studio, it takes only a few milliseconds to complete (always less than 10). When I do the same query in NHibernate, it takes over 30 seconds. I've profiled the query, and the generated SQL is fi...
I'm trying to adopt Fluent NHibernate with my project, currently I can get data from database, when I'm at application server, data is include its PK but when I return this data (as List) to client all of its PK is loose.
How can I fixed this problem?
Update
My POCO class is below: PKs are CountryCd and CityCd
public class coCity
{
...