I have a question for a specific many-to-any mapping problem:
I'd like to have a fluent mapping for this simplified domain (non relevant properties removed)
public interface IModule
{
Container Container { get; }
}
//This is mapped to [dbo].Container table in the database
public class Container: Entity
{
// ...
// I need to...
I have no control over database schema and have the following (simplified) table structure:
CityProfile
Id
Name
CountryProfile
Id
Name
RegionProfile
Id
Name
I have a .Net enum and class encapsulating the lot:
public enum Scope { Region, Country, City }
public class Profile {
public Scope Scope { get; set; }
public int...
I have a table that, some of its columns are unknown at compile time. Such columns could either be of an integer value, or some Enum value. There is a table that holds all the names of such dynamic columns and also holds the column's type. This "metatable" has the following columns:
DynamicColumnId (Pk)
Name
TypeId (Integer / Enum, as ...
Hi,
can I am hoping someone can point me to the right direction on how to get count of a property and the entity using a single trip to sql.
public class Category
{
public virtual int Id { get; private set; }
public virtual string Description { get; set; }
public virtual IList<Article> Articles { get; set; }...
How should this implementation look like with fluent nhibernate 1.0 rtm
public class Repository<T> : IRepository<T> {
public IUnitOfWork UnitOfWork {
get { return ObjectFactory.GetInstance<IUnitOfWork>(); }
}
public ISession Session { get { return UnitOfWork.CurrentSession; } }
public T Get(Expression<Func<T, bool>> expression) { }
}
...
Hi There,
I have created an multi thread application on IIS (ASP.NET MVC), When the threading server started it creates 10 thread and it's execting workitems into the threads.
Usually my application working well, but some time i have got errors and i'm sure that problem is coming from fluent configuration. And I'm sure again i have ma...
Im really confused as I have several objects that share a common interface mapped using FNH like so:
.Where(t => (t.BaseType == typeof(Entity) || t.BaseType == typeof(PipelineStep))
&& t.Namespace.StartsWith("BigNose.Core.Domain")
&& !t.IsInterface)
.IgnoreBase<Entity>()
...
I am trying to map a parent child relationship between a Person object and a Organization object in FluentNHibernate using References in the mapping file like this:
References(x => x.Organization);
The relationship is a Person object contains a OrganizationId column that corresponds to a record in the Organization table with the corres...
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 auto map a simple nested object structure?
Something like this:
public class Employee : Entity
{
public Employee() {
this.Manages = new List<Employee>();
}
public virtual string FirstName { get; set; }
public virtual string LastName { get; set; }
public virtual bool IsLineManager { get; s...
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"/>
<...
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...
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...
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...
I am having a problem with duplicate blog post coming back when i run the linq statement below.
The issue that a blog post can have the same tag more then once and that's causing the problem. I know when you use criteria you can do the followingcriteria.SetResultTransformer(new DistinctRootEntityResultTransformer());
How can I do t...
When mapping a HasMany or HasManyToMany in fluent nhibernate, you can specify the column name to use for the list as a parameter to the AsList() method as follows:
HasMany(c => c.Customers)
.AsList(c => c.Column("PositionIndex"));
I would prefer to be able to set this using a Fluent NHibernate convention (either a pre-existing one...
I'm using Fluent NHibernate and need to get my Connection String from the connection.connection_string property on hibernate.cfg.xml file to create my Session Factory:
private static ISessionFactory SessionFactory {
get {
return = Fluently.Configure()
.Database(MySQLConfiguration.Standard.ConnectionString(c => c.FromCo...
We have a project using FluentNibernate to map the entities. Now I need to add some format validation to these maps. For Nullable, Length and such we are currently using the mappings. I added NHibernate Validator to the project, but received a compile time error about needing NHibernate version 2.1.2.4000. So I upgraded to that versio...