I have two entities, C and P.
C is mapped to P in a one-to-one association, with lazy="no-proxy",
like this: (P's mapping:)
<one-to-one name="c" class="C" property-ref="P" access="field" lazy="no-proxy"/>
P is mapped to C in a many-to-one association, like this: (C's mapping:)
<many-to-one name="p" column="PId" class="P" access="fiel...
Hi,
Currently in my map code pin is dropping at current location and on pin click address is displayed.
I want to display address without user interaction.
How to do it?
...
I needed a way to trim strings within my persistent class because my legacy database is using char fields. I downloaded the nHhaddIns dll to use its TrimString class which is derived from IUserType.
Using their example I created a property in my mapping class as shown at the bottom.
uNHAddIns is added as a project within my solution. H...
I have a Class A:
public class ClassA
{
public int ID {get; private set;}
public string Code {get; private set;}
public ClassB B {get; private set;}
public IList<ClassB> ListB {get; private set;}
}
And a ClassB:
public class ClassB
{
public int ID {get; private set;}
public string Code {get; priva...
I said Fluent NHibernate in the subject, but I think this is an NHibernate question. However, I didn't want to confuse things by leaving out details.
I'm using Fluent NHibernate 1.0.0.593 with NHibernate 2.1.0.4000.
First a little background...
I have a base class with three implementation classes that I'm trying to map using the Di...
I'm using schemaExport to create an in-memory database for my automatic tests. I have several (5) classes mapping their HiLo identity to the same database table, using one column per class.
This gives me a table, hibernate_unique_key, w. 5 columns. When generating the database using scemaexport, however, the table only gets a single col...
I've got two entities, one called Site and the other called Assignment. A Site may or may not have an associated Assignment. An Assignment is only ever associated with one Site. In terms of C#, Site has a property of type Assignment which could hold a null reference.
I have got two tables by the same names in the database. The Assignmen...
Can someone please give me an example of what the mappings would look like for two classes that both have composite keys and a one-to-many relationship? I have looked everywhere and tried 100 different things with no luck.
E.g.,
HeaderTable
-HCONO Decimal
-HDVNO Decimal
-HDTTK Decimal
-HDES2 String
-HDESC String
-HDESC3 String
HCO...
I have a database that accepts no null values and has a default for every field. Using fluent nHibernate, I am getting an error on an Insert if I have a component that has some, but not all properties filled out. I am just wondering how to get the DynamicInsert flag down to the component level. Perhaps it is late, but I'll just drop t...
Hi, how would I map this relationship in NHibernate (I'm using the simple idea of the auction example to demonstrate the problem)
Database Tables / Entities:
User - contains the users
Item - an item for sale (like ebay)
Bid - records a user's bid on an item
I was imagining the bid table to look like this with:
Id (PK), ItemId (FK), Us...
I'm testing out NHibernate to be the solution to my company's ORM needs. To do this, I've produced a small test model based on a school, providing some useful edge-cases for NHibernate to handle.
I'm having problems finding out how to map a custom structure as a component of an entity without using theIUserType interface. I should stres...
Hi, i have this code to get a ClassA from the database, and ClassA is superclass of ClassB. (ClassB : ClassA)
var query = from classA in GetQuerySession().Linq<ClassA>()
where classA.Code.Equals(code)
select classA;
return query.FirstOrDefault();
ClassA and ClassB are mapped to ...
Hello!
I have been trying for quite a while to work out how to accomplish my mission, and in fact I am not even sure that the direction I am heading in, is indeed a diserable one in terms of my SQL tables - but it is the most concise I have been able to think up on.
My problem is fairly simple to describe. I have a table containing com...
I have a custom CMS implementation where each article can be linked to a list of tags. the nh mapping for this part looks like this:
<bag name="Tags" lazy="true" table="CMS_Articles_Tags" cascade="all-delete-orphan" batch-size="10">
<key column="article_id"/>
<element column="tag" type="string"/>
</bag>
the rest of the mapping is ...
Hi,
I have the following class:
public class Product
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual Decimal PricePerMonth { get; set; }
public virtual BillingInterval DefaultBillingInterval { get; set; }
public virtual string AdditionalInfo { get; set; }
}
and the mapping look...
I'm learning NHibernate and hoping you guys could help me a bit about Tag Cloud design and solutions.
I have 3 tables which are "News", "Tags" and "News_Tags" with Many-To-Many relationship and the "News_Tags" is the link table.
Options:
cascade="all", cascade="all-delete-orphan" If I delete one of the news records, the it will delet...
I've got an object that uses System.Version as a property. I want this object to be mapped into my table, storing the version as a string. what's the best way to go about doing this with NHibernate v1.2?
public class MyClass
{
public Version MyVersion {get; set;}
}
not sure what to do with the propery mapping
<property name="MyVers...
=== CLARIFICATION ====
The 'answers' older than March are not answers to the question in this post!
Hello
In my domain I need to track allocations of time spent on Activities by resources. There are two general types of Activities of interest - ones base on a Project and ones based on an Account.
The notion of Project and Account hav...
I have two entities like so (distilled to only what's relevant):
public class Person {
public virtual Address Address
}
public class Address {
}
Person has a many-to-one relationship with Address, or in object terms, a Person references an Address, and this link is uni-directional (Address does not have a reference back to Person...
I'm using Fluent NHibernate to create an ASP.NET MVC project, with Submissions and Votes (Up/Down) by Users.
Of course, Users can vote submission Up or Down. To record this, I created a middle table, SubmissionVote, which contain the following fields:
submissionId (int)
userId (int)
score (enum: up/down)
Here are my mappings:
Submis...