I'm having trouble ordering by more than one field in my Linq to NHibernate query. Does anyone either know what might be wrong or if there is a work around?
Thanks!
Rob
Code:
IQueryable<AgendaItem> items = _agendaRepository.GetAgendaItems(location)
.Where(item => item.Minutes.Contains(query) || item.Description.Contains(query));
...
I have classes BidiParent and BidiChildList which link parents and children in a bidirectional parent-child relationship. If a child's parent is updated by e.g. the service layer, the old and new parents' children lists are automatically updated to reflect the change. Likewise, if a parent's children list is updated by e.g. adding a new ...
Anyone knows what is the status of the Linq to NHibernate project?
Is it in any kind of "production"?
Cannot find the project site (bug reports, feature requests, people etc.), so that I could try to contribute?
The latest post I was able to find was about Linq to NHibernate in LinqPad, and some Ayende's posts back from 2007...
...
To keep my integration tests independent I remove all old data and insert new test data before each test. Is there a better way of doing this than simply querying for all entities and deleting them one by one?
I have considered writing a stored proc that runs "delete from tablename;" for each table that is to be cleared. That ought to q...
I am looking to do the following with a single database query if possible.
public class Location
{
public string URL {get;set;}
public IList<Page> Pages {get;set;}
}
Page firstPage = Session.Linq<Location>()
.Where(location => location.URL == "some-location-url")
.Select(location => location.Pages).FirstOrDefault(...
I have been looking around for some example projects or tutorials on Linq to Nhibernate.
Does anyone know of any good ones?
...
Calling Get in the following code works fine:
public class ContractService : IContractService
{
private readonly IRepository<Contract> repository;
public ContractService(IRepository<Contract> repository)
{
this.repository = repository;
}
public Contract Get(int contractId)
{
return repository.Query()....
When using Linq2Nibernate is better to make you Repository return a IQuerable?
My understanding is that if you use Linq to Nibernate the the query will not "fire" until you call .First() or Single() ect ect. So would it not be best to return IQuerable from all you Interfaces so you can build up\manipulate the expression tree before it ...
I thought that the purpose of using Linq2Nibernate was to return IQueryable and build up an expression tree. I am not sure if this is correct or not.
Why would anyone use Linq2Nibernate if they are not going to return IQueryable?
What else would it be used for?
I would love some more input on this topic
Linq For Nhibernate
...
So the nHibernate 2.1 Alpha came out a few days ago, but the announcement on sourceforge doesn't mention the additional features. In particular, it doesn't mention whether LINQ is included. I know that I've read that LINQ would be part of 2.1, but that was 6 months ago. Anybody know if LINQ is in 2.1 or what new features are? There's no ...
Anybody know of a way to batch NHibernate queries using NHibernate.Linq like you can do with MultiCriteria and ICriteria objects?
With MultiCriteria I can create something like this:
var crit = session.CreateMultiCriteria()
.Add(session.CreateCriteria(typeof(Entity1)).Add(Restrictions.Eq("Property1","Value"))
...
When I execute the following query, I get an exception telling me that 'feedItemQuery' contains multiple items (so SingleOrDefault doesn't work).
This is expected behaviour when using the Criteria api WITHOUT the DistinctRootEntity transformer, but when using linq, I expect to get a single root entity (FeedItem, with the property Ads (of...
If i do
Session.Linq<MyClass>().Where(x => x.Id = someId).FirstOrDefault();
where MyClass has a set of eager loaded child object on it, the FirstOrDefault() seems to prevent this from working by adding a TOP 1 to the SQL.
Is this just a bug (feature?) in Linq2NH (which i understand is being rewritten) or am I missing something?
Is...
Hi,
I have a problem using Linq to NHibernate to load an object and eagerly load a child collection. The objects look like this:
public class Order
{
public Guid Id {get; set; }
public IList<OrderLine> OrderLines {get;set;}
}
public class OrderLine
{
public Guid Id {get;set;}
public string Item {get;set;}
}
I am tryi...
I am working with Linq-To-NHibernate. I need to use some properties that is not mapped to columns.
For example
Repository<Person>
.Find()
.Select(p => new PersonModel() { Id = p.Id, FullName= p.FullName,Position = p.Position });
The position is not a mapped property, it contains some logic.
I got unmapped property error.
Thank...
I'm unable to convert this SQL query into a working linq statement
select sum(cena), id_auta, max(servis)
from dt_poruchy left outer join mt_auta on dt_poruchy.id_auta=mt_auta.id
where dt_poruchy.servis>=3 group by id_auta;
I tryed something like this but i cant handle the select statement
var auta = from a in MtAuta.FindAll()
...
Hi,
I've been developing a webapp using Linq to NHibernate for the past few months, but haven't profiled the SQL it generates until now. Using NH Profiler, it now seems that the following chunk of code hits the DB more than 3,000 times when the Linq expression is executed.
var activeCaseList = from c in UserRepository.GetCases...
Does Linq-to-NHibernate support retrieving data from multiple entities in a single query?
e.g.
Dim query = From f In context.Session.Linq(Of Floor)() _
Select f.Id, f.Name, f.Building.Id, f.Building.Name
Dim results = query.ToList()
Where Building is the parent entity of Floor
...
Given this inheritance mapping:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="User" table="[User]" abstract="true">
<joined-subclass name="SubUser1" table="SubUser1">
<key column="UserId" />
...
</joined-subclass>
<joined-subclass name="SubUser2" table="SubUser2">...
Hi,
We are using accountability pattern for organizational structure. I using linq to nhibernate to find some departments and position but I have two problem.
var query =
Repository<Party>.Find(p => p.IsInternal == true)
.Where(p => p.Parents.Any(c => c.Parent.PartyId == id))
.Where(p =>
(
p.PartyType.PartyTyp...