I am a newbie to Object Oriented Programming. I am working with Windows Application and Model View Presenter Pattern and I want to have the Change tracking available. My question is as follows
Do I need the presenter to hold a Nhibernate Session or Linq to Sql Datacontext for my Unit Of Work? Is this the simplest way I can architect a W...
Hi there!
I am a beginner in ASP.Net. I am starting a new project using ASP.Net and Nhibernate. I figured out that the hibernate.cfg.xml would not do the trick for the configuration of Nhibernate. I googled for on how to configure NHibernate in ASP.Net and this is simplest that I got but I can't get it to work. I also downloaded some pro...
Hey,
I'm trying to figure out how to best use Sessions in (N)Hibernate. I have a C# remoting object (MarshalByRefObject) which gets consumed by an ASP.NET client.
Currently my remoting class opens up one Session instance in the constructor and uses that one for all transactions. Is this a good idea? And would I need a finalizer for the ...
Hello:
A TimeSheetActivity class has a collection of Allocations. An Allocation is a value object (immutable) looking something like this:
public class Allocation : ValueObject {
public virtual StaffMember StaffMember { get; private set; }
public virtual TimeSheetActivity Activity { get; private set; }
public virtual DateTi...
Hi,
Currently I have the following classes:
class Article with properties id, title and body
class Question : Article with an extra PostedBy property
Then I have a table called Article with the above properties and a table called questions with an ID a foreign key articleID and a PostedBy. Both are in different schemas
I would like t...
Hi all,
I'm new to nhibernate so this should be easy. I have a mapping file as below although I deleted some fields that aren't relevant to this question. The streamfields class contains a bag of fieldmappings. I want the join to be on field_no column but the sql that is sent is on the id field (str_fld_id") as seen below.
I see what t...
Hi,
I am having an issue with many-to-many mapping using NHibernate. Basically I have 2 classes in my object model (Scenario and Skill) mapping to three tables in my database (Scenario, Skill and ScenarioSkill). The ScenarioSkills table just holds the IDs of the SKill and Scenario table (SkillID, ScenarioID).
In the object model a Scen...
I am trying out some cascade options with nhibernate mapping and have a unit test where I'd like to use a tool to inspect the state of the database. I was hoping I could use linqpad to do this, but the connection seems hung while in the debugger. I'd seen a demo not to long ago where SSMS was being used to inspect the db during a debug, ...
Hi folks. I could not find the answer amongst the many posts on Linq, so here I am.
We have a client-server application, where the client side has absolutely no knowledge of the actual DAL on the server side, which is incidentally implemented using NHibernate. Meaning, there is no references to NHibernate from the client side assemblies,...
Hi!
Can I somehow tell NHibernate to map my one-to-many relationship to a property which is of type List instead of the interface IList?
I know that NHibernate uses its own IList-implementation for lazy loading, but I don't need this feature. Instead I need a class that is serializable, which I cannot accomplish by using the IList inte...
If you don't want to expose the ID of a domain object to the client of a WCF service, you would obviously not put an ID property in the DataContract, right? But then, when the client calls the save method on your service, how do you know it's a new object, or an existing one that was modified?
With NHibernate you can use SaveOrUpdate an...
Update
I've been looking around the NHibernate.Search.Tests project to find out how the Criteria API is used (i find it immensely useful to look around the test code to have working examples) and i noticed that the way to use the Fulltext search is radically different. Here are two tests, one with the criteria API, one with the classic ...
Hi guys,
I don't know whether this question has been asked before or not.
But i was trying to use cascading delete, but couldn't find enough documentation to get my answers that is why Im asking here.
I have one parent class and two child classes dependent on that.
When i delete parent it should delete the other two child classes as wel...
Hi all,
I have been playing with NHibernate (especially Fluent NHibernate) for couple months. I really like it and appreciate people who contribute to those projects.
I am trying to create an Oracle Text Index using NHibernate, but I couldn't get this to work.
session.CreateSQLQuery("create index MYSCHEMA.NAME_TEXT_INDEX on MYSCHEMA...
In the project I'm working on now, we have base Entity class that looks like this:
public abstract class Entity<T> where T : Entity<T>
{
public virtual object Id { get; protected set }
// Equals, GetHashCode overrides, etc...
}
Most classes inheriting from Entity should map Id to int column in SQL Server database, but at l...
First off, I am not a DBA, but I do work in an environment where DBAs do tune/make changes in the production database from time to time in ways that do not cause the need for an application rebuild/redeployment. Usually these changes consist of reworking indexes, changing procs, and sometimes changing the table structure in minor ways (u...
Hi guys,
I have a parent class which contains a child object.
I am using set to save the child object when parent is saved.
I m not sure whether set is used for just saving a child object.
And im getting this error below
System.InvalidCastException: Unable to cast object of type 'x' to type 'Iesi.Collections.ISet'
Does anybody knows th...
I am trying to save chinese character into oracle DB using Nhibernate thru C# and the character saved always end up with some rubbish character.
I have done the following:
Hbm mapping for the field is
declared as type AnsiString and
column type as sql-type="nvarchar".
Have also tried String and nvarchar2
too.
Database column data typ...
Here is an example of my class:
public class ClassX
{
private ClassY _y;
public ClassY PropertyA
{
get { return _y ?? (_y = new ClassY(this); }
}
}
public class ClassY
{
public virtual string PropertyB { get; set; }
}
My table looks like this:
table ClassX { PropertyB varchar }
So I need PropertyA to be cons...
I have a stored procedure that logs some data, how can I call this with NHibernate?
So far I have:
ISession session = ....
IQuery query = session.CreateQuery("exec LogData @Time=:time @Data=:data");
query.SetDateTime("time", time);
query.SetString("data", data);
query.?????;
What should the method ????? be? Or am doing something more...