I'm building a form that will allow my site's users to set a secret question and answer. I'm using NHibernate to persist my model to our database.
public class User {
public string Question { get; set; }
public string Answer { get; set; }
}
I want to encrypt the input from the user before storing it in the database. My first ...
I have two entities that I need to treat polymorhically, each of which has a similar "business id" type of property. As you might expect, there is semantic meaning to each id in the domain, and there is an object type to represent it. In one entity, a Project, the domain language of this property is a ProjectCode. In the other entity, an...
I have a lot of classes and this is a lot of work to do the XML mappings.
...
For every application_start, I call ActiveRecordStarter.Initialize (actually it's part of the ActiveRecordIntegration facitliy). This seems to be very heavy, takeing around 3.5 seconds to initialize my 16 objects.
some background:
1. got 16 AR objects for now, almost never changed (maybe once a week).
2. most of the changes are not AR r...
I have criteria:
ICriteria criteria = Session.CreateCriteria<Entity>()
.SetFetchMode("Entity1", FetchMode.Eager)
.SetFetchMode("Entity2", FetchMode.Select)
.SetMaxResults(max)
.SetFirstResult(min)
.Add(Restrictions.Eq("Available", true))
.Cre...
I've got an issue trying to code up some QueryOver query. I've got an entity Branch, which has a list of Users entities - UserList. I've coded the QueryOver object, I've got the join right using an alias, BUT ( see code )
Iesi.Collections.Generic.ISet<User> userAlias = null;
IQueryOver<Branch, Iesi.Collections.Generic.ISet<User>> userQu...
Did anyone tried out to use nHibernate with monotouch framework? Are there any issues that I should take in concern? Or this scenario is not possible?
...
Using this, I can tell Fluent NHibernate to use SysCache as a 2nd Level Cache Provider:
MsSqlConfiguration.MsSql2008.ShowSql().ConnectionString(x =>
{
x.Server(@"localhost\ANDREPC");
x.Database("mydb");
x.TrustedConnection();
}).Cache(c => c.ProviderClass<SysCachePr...
I can't get NHibernate to delete this child object, it completes without throwing any exceptions and without deleting anything:
public void DeleteW9(int vendorId, int vendorW9Id)
{
var vendor = vendorRepository.Get(vendorId);
var W9 = vendor.W9.Where(x => x.Id == vendorW9Id).First();
vendor.W9.Remove(W9);...
The following LINQ to NHibernate (using NHibernate 3.0) results in a System.InvalidOperationException being thrown with the message "The binary operator Equal is not defined for the types 'System.Collections.Generic.IList`1[System.Int32]' and 'System.Int32'"
public IEnumerable<ProjectSummary> GetProjects( IList<int> clients )
{
usin...
If possible give short example or link to example, thanks.
...
I got a legacy database which have about 10 identical tables (only name differs).
Is it possible to be able to use the same business entity for all tables without having to create several classes/mapping files?
...
I have a table which needs a relationship over itself.
Table Example:
field_PK ---> Primary key
field_A ---> used as Foreign key to field_B
field_B
Mapping:
<id name="field_PK">
<generator class="assigned"/>
</id>
......
<bag name="childs">
<key column="field_A" update="false"/>
<one-to-...
Hi all,
I was wondering how I would handle aggregate roots that contain collections with alot of entities.
Like:
public class AggregateRoot
{
public ICollection<Child> Children { get; set; } // 10.000 entities
}
How would I query the child collection to get specific children? I am using Nhibernate btw.
...
Does anyone know of a resource for Criteria Queries in NHibernate that demonstrates complex criteria restrictions.
For example
select rows in the parent table and
only rows in a child table that match
a criteria
set eager fetching on parent and
child in the criteria
i.e. not just simple criteria, but something a bit more meaty. I ha...
I am stuck with a legacy database involving composite keys and there is no room to modify the db.
The problem seems to be that one part of the key is also used for each foreign key.
So if I have tables A and B like this:
A
company (PK)
aId (PK)
someMoreInfo
B
company (PK, FK)
bId (PK)
aId (FK)
someOtherInfo
The company fiel...
Hello,
In Building a Desktop To-Do Application with NHibernate, Oren Eini (a.k.a. Ayende Rahien) shares that the general recommended NHibernate practice is to use one session per form in a desktop application. In the example given, this is easily implemented because the form presenters have knowledge of the persistence layer and so can...
Using NHibernate, I am trying to set the value of a class contained within another class. For example:
public class Object
{
public virtual string CODE { get; set; }
public virtual string INFO { get; set; }
public virtual int ID { get; set; }
public virtual Location location { get; set; }
}
public class Location
...
I'm working on a ASP.NET MVC application. In my solution, I have some projects:
Domain - class library, my DAL. Reference NHibernation etc, but not log4net.
WebUI - ASP.NET MVC project, references log4net. Does NOT reference NHibernate (hence the DAL project)
In my web.config, I have configured log4net this way:
...
Hi All,
I have a problem that I'm working in nHibernate project that have the following object:
[Serializable]
public class Prototype
{
public virtual long Id { get; private set; }
public virtual string Name { get; set; }
public virtual IList<AttributeGroup> AttributeGroups { get; private set; }
}
and I have created a ...