Currently I can get this SetResultTransformer method to return a List of some arbitrary kind of DTO as follows:
var result = _session.CreateCriteria<Company>()
.Add(Restrictions.In(groupCompanyInfo, (int[])groups.Select(xx => xx.Id).ToArray()))
.SetProjection(Projections.ProjectionList()
.Add(Projections.GroupProperty(gr...
I am setting up Castle Active Record to access a legacy database on an Microsoft SQL Server. The table in question has a column named function. When I attampt to load a record it gives me this error:
Incorrect syntax near the keyword 'function'
This error comes about because the SQL query nhibernate generates attempts to access the c...
Hi Guys,
I am writing an NServiceBus solution and trying to use DBSubcriptionStorage. This uses NHibernate for data access and I get the following exception:
The partner transaction manager has disabled its support for remote/network transactions
I could enable MSDTC but my question is: where is this requirement coming from and ca...
I'm querying an SQLite database using NHibernate. Generally, I want to do case insensitive string queries. Recently, I've discovered that although I can insert a row with Cyrillic characters, I can not select it using a case insensitive query. This is what the query looks like:
string foo = "foo";
IList<T> list = session.CreateCriteria(...
Hi All
I'm new to nhibernate, and I'm sorry if this is answered elsewhere, but I've been looking for the last couple of hours, and can't find a solution that works.
A bit of background:
I'm trying to write an Admin area where there are users and sites, and a user can have access to multiple sites - but at various permission levels for ...
Hi,
I'm trying to add a mapping to the table IdentityGroup which has ManyToMany IdentityUsers thought the table IdentityGroupIdentitiy. However when I add the mapping. The result seems to be a something like a cross join.
Expected result for a group with two users:
Group 1:
User 1
User 2
Current result for a group with two u...
I have a question that may seem stupid and simple, but I hardly have any idea how to proceed with it.
My question is:
How can I modify the exception message and customize it such that I still have my unit testing passing?
Actually I want to customize the exception message to "Student "Johny" had related files!" and as modified the API...
I tried to run my unit tests with C# Sqlite instead of going to a real database or mocking the hell out of our database layer using this blog post as guideline: Nhibernate C# Sqlite.
Unfortunately NHibernate requires a connection to be an DbConnection which is not provided by the C#-Sqlite Driver. I looked into the source code and notic...
I want to return a sngle object usig a guid (its not the primary key, but it is unique)
I am able to return a single object using the id by:
public User GetUserById(Int32 userId)
{
User user = null;
using (ITransaction tx = _session.BeginTransaction())
{
try
{
user = _session.Get<User>(userId);
...
I am listening to audit events in NHibernate, specifically to OnPostUpdateCollection(PostCollectionUpdateEvent @event)
I want to iterate through the @event.Collection elements.
The @event.Collection is an IPersistenCollection wich does not implements IEnumerable. There is the Entries method that returns an IEnumerable, but it requires...
Hi
I am having trouble with using NHibernate's Linq querying functionality when trying to page data in a silverlight application.
I have a DomainService with a method like:
[Query(ResultLimit = 50)]
public IQueryable<Category> GetCategories()
{
return _Session.Linq<Category>();
}
In the silverlight app, I am trying to page fo...
Hi, I'm trying to delete an entity (ForumTopic) and have that delete the Posts (ForumPost) within it. Here are my entities:
public class ForumTopic
{
public virtual int TopicID { get; set; }
public virtual IList<ForumPost> Posts { get; private set; }
...
public ForumTopic()
{
Posts = new List<ForumPost>();...
Hello all,
I have an entity called Strategy, and another one called Team. Both are mapped using a Many-To-Many relationship:
public class Team : BaseEntity<Team>
{
private readonly IList<Strategy> allStrategies = new List<Strategy>();
public void AddStrategy(Strategy strategy)
{
allStrategies.Add(strategy);
...
Lets say I have 4 classes
Student { int StudentId, string StudentName, IList<BaseMarks> StudentMarks}
BaseMarks {bool GrandTotalMarks}
SpecializedMarks: BaseMarks {Ilist Results}
Result {string grade, bool Result}
Now,
I have a method which populates Students list IList and nested marks collection but typecasts it internally to s...
I want to export a schema from my types annotated with NHibernate attributes. Is this possible?
My current code is below, needless to say, it compiles, but the expected table TestType does not get created.
I have a type as follows:
[Serializable, Class(Schema = "test")]
public class TestType
{
[Property]
...
Hi,
I am trying to use NHibernate to save an object that was completely manually created. My mappings are in place and I currently have no data in the database. Everytime I call Save() or SaveOrUpdate(), NHibernate does a select statement for what I am trying to save. Then it gives me the exception: "a different object with the same ...
Good evening people,
I have been using Fluent Nhibernate for a while, I've never really dug too deep into its functionality or the many ways it can be configured. In every project I have used it in I have configure it as follows:
if (nhConfig == null)
{
nhConfig = new NHibernate.Cfg.Configuration();
...
Is there a way to ask NHibernate to automatically retry failed connections to a database? Specifically, if my network connection is too unreliable, sometimes NH will fail to connect to my remote SQL Server.
...
Ok I have 2 objects and a foreign key.
The first object is.
public class OutboundEmailMap : ClassMap<OutboundEmail>
{
public OutboundEmailMap()
{
Table("OutboundEmail");
Id(x => x.Id, "OutboundEmailId")
.UnsavedValue(0)
.GeneratedBy.Identity();
Map(x => x.OutboundEmailGuid...
Hello,
I'm having difficulties with translating following SQL syntax into Criteria API:
SELECT AVG(dbo.Member.Points) FROM dbo.Member WHERE dbo.Member.PaidMemberRegDate IS NOT NULL;
I have a Member class with a Points property. I just want to get the average Points of all Members that have the property PaidMemberRegDate set to null.
...