I couldn't find an answer to this specific question. I am trying to keep my domain model object-oriented and re-use objects where possible. I am having an issue determining how to provide a mapping to multiple classes from a single row. Let me explain with an example:
I have a single table, call it Customer. A customer has several a...
Hi,
I am having a problem in that the objects that I am using to map to nhibernate all implement an interface and on each interface any relationships with other objects are defined as an interface property. So given the following interface,
public interface ISettingValue
{
int RoleId { get; }
ISetting Setting { get; }
st...
so we upgraded to newer Nhibernate and Fluent Nhibernate.
now I' getting this exception:
FailedNHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. near line 1, column 459
On this hql, which worked fine before the upgrade.
SELECT s.StudId, s.StudLname, s.StudFname, s.StudM...
Sorry if this seems a bit naive, but I'm just crawling my way into unit testing and fluent!
The example!
Two tables, 'Address' and 'Regions'. The test for Address runs first using a CheckReference for a region (creating record 1 in the Regions table) then when the Regions test runs it fails as the system returns the record for the Addr...
I have a fairly simple class that I want to save to SQL Server via NHibernate (w/ Fluent mappings). The class is made up mostly of optional string fields.
My problem is I default the class fields to string.empty to avoid NullRefExceptions and when NHibernate saves the row to the database each column contains an empty string instead of...
I have a domain entity that has a flagged enum as a property. The flagged enum is the target audience for the these entities. The user then has a flagged enum value of the entities they should see. I am trying to figure out the correct expression to select entities that meet the target audience for the user.
public class File
{
pu...
Below is an example of how I currently use automapping overrides to set up a my db representation of inheritance. It gets the job done functionality wise BUT by using some internal default values. For example, the discriminator column name winds up being the literal value 'discriminator' instead of "ActivityType, and the discriminator va...
Is it possible to use something like this wrapper with fluent configuration?
http://jeffreypalermo.com/blog/use-this-nhibernate-wrapper-to-keep-your-repository-classes-simple/
If so, where would I add the fluent config?
Also, would this be suited to use in both asp.net and windows applications?
I'm planning to use the repository patte...
Hello,
I am trying to get Fluent nHibernate to generate mappings so I can take a look at the files and the sql.
My code is based on this post and on what I can glean from the documentation.
http://stackoverflow.com/questions/1375146/fluent-mapping-entities-and-classmaps-in-different-assemblies
I am using the latest code from git.
He...
I'm looking for ways to generate the application database full structure based on the NHibernate mapping data. The idea is to give the user an option to supply a database-connection string and then to build their a database with the structure that the application needs.
The database need to independent - it means that it needs to work w...
I am used to hbm files and have started using fluent nhibernate recently.
Creating an m-to-m relationship between two entities A and B is quite simple
In entity A, I create:
public virtual IList<B> Bs { get; set; }
and then I use:
mapping.HasManyToMany(x => x.Bs);
That’s it and I can do:
A a = new A();
a.Bs.Add(b);
My problem ...
I think this is a moderately neophyte question. I've been using NHibernate/FluentNHibernate for about 6 months or so, and I think I have a fair grasp of the basics. Now I'm pushing a little bit beyond. I'm sure this is documented, but I've spent several hours now on Google, and haven't quite figured it out.
I have simple class, call it...
I am trying to pass strings to my build Factory function. One string would be the path and name of the EO.dll. The other would be the path and name of the Map.dll.
When I was hard coding the class name this worked for me.
//// this was the origonal
//m.HbmMappings.AddFromAssemblyOf<Add...
Is there a Class Map generator for Fluent NHibernate? I need something like db2hbm but I want it to generate Fluent Class Maps instead of xml mappings.
I am aware of AutoMapping for Fluent but that is not what I want. I want to be able to generate Class Map files from tables in database and push them to my src repository.
...
Hi. I have a qouestion regarding the AutoMap xml generation.
I have two classes:
public class User
{
virtual public Guid Id { get; private set; }
virtual public String Name { get; set; }
virtual public String Email { get; set; }
virtual public String Password { get; set; }
virtual public IList<OpenID> OpenIDs { get; set; }
}
...
Hi,
Could some one help, how would I instruct automap to have not-null for
a cloumn?
public class Paper : Entity
{
public Paper() { }
[DomainSignature]
[NotNull, NotEmpty]
public virtual string ReferenceNumber { get; set; }
[NotNull]
public virtual Int32 SessionWeek { get...
I'm currently using a convention to (auto)map collection properties to backing fields in Fluent NHibernate. So, I map a property "Orders" to a field "_orders". The convention I'm using to do this is:
public class HasManyAccessConvention : IHasManyConvention
{
public void Apply(IOneToManyCollectionInstance instance)
{
ins...
The project I'm working on has a legacy database with lots of information in it that's used to alter application behavior. Basically I'm stuck with something that I have to be super careful about changing.
Onto my problem. In this database is a table and in this table is a column. This column contains integers and most of the pre-existi...
Is there a way in fluent nhibernate (or possibly NHibernate in general) to tell it to generate the primary keys differently? It creates the column name for the key fine, but the index/constraint gets weird generated names like:
PK_Address_3214EC2725332734
PK_CreditCa_3214EC2756CA82C8
etc...
I can use straight sql to rename them but ...
I am building a framework where people will be able to save items that the created by inheriting a class of mine. I will be iterating over every type in the appdomain to find classes that I want to map to nhibernate. Every class that I find will be a subclass of the inherited type.
I know how to create sub types in FluentNhibernate, but...