I am using Fluent Nhibernate and Nhibernate for my current project. I need to record the time to the millisecond. I have this for my mapping
Map(x => x.SystemDateTime)
.CustomType("Timestamp")
.Not.Nullable();
I genertaed the hbm.xml files and the line is the following:
<property name="SystemDate...
I know this has been asked several times and I have read all the posts as well but they all are very old. And considering there have been advancements in versions and releases, I am hoping there might be fresh views.
We are building a new application on ASP.NET MVC and need to finalize on an ORM tool. We have never used ORM before and h...
I have a model with a Dictionary<string, string> property that is stored in the database using JSON. I am using a custom NHibernate type to map the dictionary to and from a JSON-encoded string, which works fine.
My problem is that when I flush the session, and the only property that has changed is this dictionary, then the entity is not...
Hi all,
I'm new to Fluent NHibernate and I'm running into a problem.
I have a mapping defined as follows:
public PersonMapping()
{
Id(p => p.Id).GeneratedBy.HiLo("1000");
Map(p => p.FirstName).Not.Nullable().Length(50);
Map(p => p.MiddleInitial).Nullable().Length(1);
Map(p => p.LastName).Not.Null...
Hello,
I am changing my application to use Fluent NHibernate. I have created my Fluent mapping files and have now moved onto configuring my Session Manager. Currently, I use the following code -
private ISessionFactory GetSessionFactory()
{
return (new Configuration()).Configure().BuildSessionFactory();
}
Along with my hiberna...
Hi Guys, hows it going?
I'm in my first time with DDD, so I'm begginer! So, let's take it's very simple :D
I developed an application using asp.net mvc 2 , ddd and nhibernate. I have a domain model in a class library, my repositories in another class library, and an asp.net mvc 2 application. My Repository base class, I have a construct...
I've got a simple many-to-one relationship (an Order has a Customer who placed it). Here's the except from my Order mapping:
<many-to-one name="Customer" column="FK_CUSTOMERS" class="MyApp.Customer, MyApp"
not-null="true" lazy="proxy" cascade="none" />
Yet the following does not pass:
configuration.GetClassMapping(typeof(Order))
...
I have see a lot of competing theories about hierarchical queries in fluent-nHibernate or even basic nHibernate and how they're a difficult beast.
Does anyone have any knowledge of good resources on the subject. I find myself needing to do queries similar to: (using a file system analog)
select folderObjects from folders where folder....
I don't like the idea of proxy and lazy loading. I don't need that. I want pure POCO. And I want to control loading associations explicitly when I need.
Here is entity
public class Post
{
public long Id { get; set; }
public long OwnerId { get; set; }
public string Content { get; set; }
public User Owner { get; set; }
}
and mappi...
Hello,
I am using Nhibernate 2 and PostgreSql
The above code generate a query with a cast on expression
res = _session.CreateCriteria(typeof(C))
.Add(Restrictions.Eq("Exp", Exp))
.AddOrder(new Order("Fr", false))
.SetMaxResults(MW)
.List<C>();
Exp is a c...
We are tasked with migrating an existing set of entities (currently POCOs persisted with NHibernate against an MSSQL database) to now persist to some kind of web service (yet to be built, either RESTful or SOAP-based, and that we control).
I like how NHibernate encapsulates the persistence concerns and lets us maintain a logic-rich, per...
Is there any ICompositeType implementation for System.Uri?
I want to be able to use this query: where a.Uri.schema == 'https'.
...
I'm using Fluent Nhibernate with the following query on DerivedClass which extends BaseClass:
var query = Session.CreateCriteria<DerivedClass>().SetLockMode(LockMode.Upgrade)
What I want is the lock hints (updlock, rowlock) to be applied to both DerivedClass and BaseClass, but the generated SQL only applies the lock hints to DerivedCla...
Hi,
I have a Date class which wraps over the DateTime? class (aids in mocking DateTime.Now, our domain ,etc).
The Date class class only has one protected property : DateTime? date
public class Date
{
protected DateTime? date;
}
// mapping in hbm
<component name="CompletedOn">
<property column="StartedOn" name="date" access="fie...
I'm experimenting with using a string for storing different kind of data types in a database. When I do queries I need to cast the strings to the right type in the query itself. I'm using .Net with NHibernate, and was glad to learn that there exists functionality for this.
For the example I'm using this simple class:
public class Foo...
Hello,
I have been successfully using NHibernate, but now I am trying to move to Fluent NHibernate. I have created all of my mapping files and set up my session manager to use a Fluent Configuration. I then run my application and it runs successfully, but no data is returned.
There are no errors or any indication that there is a proble...
I have a problem with entity refreshing in NHibernate.
I have an entity with IList property; this property is mapped with "list" tag on hbm mapping file.
Now, on maintenance window if I remove some elements from the list (without saving) and then I call NHibernate refresh to restore changes the list items, that previously I removed, ar...
Consider the following Class structure...
public class ListViewControl
{
public int SystemId {get; set;}
public List<ControlAction> Actions {get; set;}
public List<ControlAction> ListViewActions {get; set;}
}
public class ControlAction
{
public string blahBlah {get; set;}
}
I want to load class ListViewControl eagerly...
Здравствуйте, ANRY!
Совсем недавно при прохождении практики от университета, столкнулся с NHibernate. Тут же прочитал вашу статью "Hello NHibernate!". Понадобилось реализовать некое подобие магазина: то есть, есть товар, клиент, заказ. Соответственно создал 4 таблицы в MSSQL 2010: Товар(id_товара, название, цена), Клиент(id_клиента, имя...
Hi all,
I'm developing an application using asp.net mvc, NHibernate and DDD. I have a service layer that are used by controllers of my application. Everything are using Unity to inject dependencies (ISessionFactory in repositories, repositories in services and services in controllers) and works fine.
But, it's very common I need a met...