This is the SQL that I want to accomplish:
WHERE domain_nm + '\' + group_nm in ('DOMAINNAME\USERNAME1','DOMAINNAME2\USERNAME2')
I can't for the life of me find an appropriate Expression for this. And I don't think I can use two expressions as the domain name and the group name need to be concatenated.
Thanks!
...
I want to create a query which has more than 3-4 Expression.Or ? But Expression.Or just let me to add two Expressions inside it.
if (!string.IsNullOrEmpty(keyword))
query
.Add(Expression.Or(
Expression.Like("Name", keyword, MatchMode.Anywhere),
...
Hi,
I have an entity that has a string property called Tags. I would like to query this entity based upon if a certain string is located in Tags property.
So for example, I would have a function IList GetEntityByTag(string tag), this would return all Entity's that have the value of tag in their 'Tags' property.
I tried going through t...
Hi,
I have an "Estate" entity, and this entity has a collection "EstateFeatures"(type:EstateFeature) and EstateFeature has a property "MyFeatureValue".
Note: These are the limited properties for the question. All Entities has an Id and all necesarry etc
Estate
IList<EstateFeature> EstateFeatures;
EstateFeature
FeatureValue MyFeat...
I would like to write something like DetachedCriteria but I don't want to use the ISession or Nhibernate at all...
All I need is the implementations for ICriterion and Expression.
after writing such Criteria -> I would like to generate an Xml Query or AD-Query or maybe even Query on collection (something like the Linq2Objects)
Do you ...
I have a legacy database that I am mapping using NHibernate. The objects of concern are an Account and a list of Notification objects. The objects look like:
public class Notification
{
public virtual int Id { get; set; }
public virtual DateTime BatchDate { get; set; }
/* other properties */
public virtual Account Acco...
Using the standard NHibernate example of Cats and Kittens, how would I use ICriteria to sort Cats based on Kitten count? For example, I want to do something like:
ICriteria crit = Session.CreateCriteria(typeof(Cat));
return crit.Order(Order.Asc("**Kittens.Count**"));
Anyone know how to achieve this?
...
Is there any good ICriteria API overview? Chapter 12 from the official NHibernate reference is too short and I still don't have clear view of the ICriteria usage.
...
I'm using NHibernate to query my database with the criteria API. My criteria is below:
ICriteria c = Session.CreateCriteria(typeof(Transaction));
ProjectionList projections = Projections.ProjectionList();
projections.Add(Projections.Sum("Units"), "Units");
projections.Add(Projections.GroupProperty("Account"), "Account");
projections.Ad...
I have the following issue in the project I am working on. Each transaction in the system is assigned to a given user. So there is a many to one relationship between transactions and users, like so:
public class User
{
public int ID { get; private set; }
public string FirstName { get; set; }
....
}
public class Transactio...
Can I select a random row using NHibernate's ICriteria API?
...
I'm feeling dumb.
public class Uber
{
public Foo Foo { get; set; }
public Bar Bar { get; set; }
}
public class Foo
{
public string Name { get; set; }
}
...
var ubercharged = session.CreateCriteria(typeof(Uber))
.Add(Expression.Eq("Foo.Name", "somename"))
.UniqueResult<Uber>();
return ubercharged;
This throws a "could not r...
I have a SQL query that I need to represent using NHibernate's ICriteria API.
SELECT u.Id as Id,
u.Login as Login,
u.FirstName as FirstName,
u.LastName as LastName,
gm.UserGroupId_FK as UserGroupId,
inner.Data1,
inner.Data2,
inner.Data3
FROM dbo.User u inner join
dbo.GroupMember gm on u.Id = ...
I'm building an advanced search form for my ASP.NET MVC app.
I have a Customer object, with an Address Component:
Fluent NHibernate mapping:
public CustomerMap()
{
WithTable("Customers");
Id(x => x.Id)
.WithUnsavedValue(0)
.GeneratedBy.Identity();
Map(x => x.Name);
Ma...
Hi,
Assuming the following scenario:
class Project{
public Job Job;
}
class Job{
public Name;
}
Assuming I want to use the Criteria API to search for all projects whose Job has the name "sumthing".
I could use the CreateAlias to create an alias for Job and use it to access Name, or I could create a new Criteria for the proper...
I have a simple Waiver model, and I would like to make a query that returns all the Waivers that are not overridden.
public class Waiver
{
private readonly int id;
protected Waiver()
{
this.id = 0;
}
public virtual int Id { get { return id; } }
public virtual string Name { get; set; }
public virtua...
This is the first time I've used NHibernate for a big project so bear with me. Basically, I need to run a search based on 5 fields.
I want to display the results in a table. Here is a test I've written that basically gets all Clients that have Intakes with a Staff named "DII". When I run it, I get an error saying that some of the I...
I have an Ms Access view(query) as following
select * from employee Where EmployeeId=SomeID
Here SomeId is not a field name
If I run this query from MsAccess
It prompts me for entering value for SomeId as follows
|---------------------------------------|
| Enter Parameter Value X |
|-----------------------------------...
Example:
Client object has a collection of Action objects which records a history of actions performed against the client. Action is abstract and has several subclasses e.g. SystemAction, CorrespondenceAction etc.
I have a client search screen which has many optional search criteria, so using the criteria API is the obvious choice. ...
I have an entity that is like this
public class Customer
{
public Customer() { Addresses = new List<Address>(); }
public int CustomerId { get; set; }
public string Name { get; set; }
public IList<Address> Addresses { get; set; }
}
And I am trying to query it using the Criteria API like this.
ICriteria query = m_Custo...