I am trying to map same column to be an attribute and a relationship (for reasons that have to do with legacy data) using following mapping:
References(x => x.BaseProductTemplate, "ProductCodeTxt");
Map(x => x.DescriptionCode, "ProductCodeTxt")
.CustomType(typeof(TrimmedStringUserType));
but "System.IndexOutOfRangeEx...
Is it possible to adopt the use of an O/RM like NHibernate or Entity Framework, and abstract it in such a way that it could be replaced if a situation is encountered that the O/RM cannot handle.
It seems tempting to create a service with chunky service methods inside of which, a session is created, the session is used to get / upsert e...
Hi!
I'm having a problem with fluent-nhibernate and criteria.
I have the following setup.
class AMap : ClassMap<A>
{
Id(x => x.Id);
...
HasMany<Connection>(x => x.Connection).Inverse().ReadOnly();
}
class BMap : ClassMap<B>
{
Id(x => x.Id);
...
HasMany<Connection>(x => x.Connection).Inverse().ReadOnly();
}
class CM...
I have two entities:
public class Parent()
{
public ICollection<Child> Children { get; set; }
}
public class Child()
{
public Parent Parent { get; set; }
}
The mapping looks like so:
public class ParentMap : ClassMap<Parent>
{
HasMany(x => x.Children).Cascade.All().Inverse();
}
public class ChildMap : ClassMap<Child>
{
...
I am using the 1.0 RTM of Fluent Nhibernate, with a 3.0 build of NHibernate. In order to do this, I need to add the following to my .config file:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NHibernate" culture="neutral" publicKeyToken="aa95f207798dfdb4"/>
<...
Let's say I have a Type II SCD database, that is basically append only. I am using NHibernate to persist objects to my database. I have an object like so:
Pony
|- int Id
|- Guid EntityId
|- string PonyName
|- string PonyColor
|- int RevisionValidFrom
|- int RevisionValidTo
Here's a typical scenario:
Pony myLittlePony = myStable.GetL...
Is there a way to generate mappings for NHibernate from POCO? This reply to my question makes NHibernate look very interesting. However i have a lot of classes that look like this
public class register_email_job
{
public PK id;
public user_data user;
}
public class user_comment : BaseComment2
{
[IsNullable]
public user_...
Hello colleagues.
I've got a question. I use NHibernate with MySql. At my entities I use Id(PK) for my business-logic usage and Guid(for replication). So my BaseDomain:
public class BaseDomain
{
public virtual int Id { get; set; }
public virtual Guid Guid { get; set; }
public class Properties
{
public const str...
I have a many to many relationship within my database. For example I have a USER table, a ROLE Table, and USERINROLE table. I have a search on my website that needs to find users in specified roles. For example I would like to retrieve User records who are in roles "reader" AND "writer"
My Query before the where looks like this:
SELEC...
What's the best way to store connection string info?
I'd rather not just store the db password in NHib.config file.
...
I had a mapping for a IDictionary<StocksLocation,decimal> property, this was the mapping:
HasMany<StocksLocation>(mq => mq.StocksLocation)
.KeyColumn("IDProduct")
.AsEntityMap("IDLocation")
.Element("Quantity", qt => qt.Type<decimal>());
Now i changed from decimal to a Value Object: Quantity.
Quantity ha...
Has anyone gotten the NH session management bits from RhinoCommons to work with Structure Map? We already use SM and do not want a dependency on Windsor.
...
Is there active development going on IBatis.Net DataMapper? Do they have version for .Net 3.5. I saw lots of activity on iBatis Java DataMapper as they are planning to release iBatis3 with annotation support. What is the status of its .Net counterpart?
...
I have these classes:
public class User
{
public IList<Order> LastOrders { get; set;}
}
public class Order {}
Where LastOrders is many-to-many map.
How do I tell (Fluent) NHibernate to remove Order from LastOrders collections for all users when I delete an Order? Is it possible?
That is (db save/load code skipped)
user.LastOrder...
Hello!
Have you been doing some ASP.NET MVC developement involving Spring.NET and NHibernate both? I would like to see an informative example of such setup, so I could build my own project off that.
I tried googling, found some pretty things like S#arp Architecture, an article about regular ASP.NET (WebForms) integrated with the framew...
I have a existing parent-child relationship I am trying to map in Fluent Nhibernate:
[RatingCollection] --> [Rating]
Rating Collection has:
ID (database generated ID)
Code
Name
Rating has:
ID (database generated id)
Rating Collection ID
Code
Name
I have been trying to figure out which permutation of HasMany makes sense here. W...
As the post title implies, I have a legacy database (not sure if that matters), I'm using Fluent NHibernate and I'm attempting to test my mappings using the Fluent NHibernate PersistenceSpecification class.
My question is really a process one, I want to test these when I build locally in Visual Studio using the built in Unit Testing f...
How to implement cloning of objects (entities) in NHibernate? In the classes of entities has properties such
public virtual IList<Club> Clubs { get; set; }
All classes are inherited from BaseObject.
I tried to implement using xml serialization, but the interfaces are not serialized.
Thank you for your answers!
...
I have found myself doing a lot of work to get nHibernate setup and am left wondering: Why use a framework like Hibernate/NHibernate? I am sure that quite a few people love the framework but I am unclear on the advantages and disadvantages. What are the advantages and disadvantages of lazy loading, and are there other features to Hiber...
Has anyone implemented this, or know if it would be difficult to implement this/have any pointers?
public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance)
{
// TODO: Implement
throw new NotImplementedException();
}
from NHibernate.Spatial.Criterion.SpatialRestrictio...