Reputation: 5524
The various objects are all valid and used elsewhere in the app:
public virtual Discount SelectDiscountByUser(User currentUser)
{
Query q = new Query();
q.Criteria.Add(new Criteria("User.ID", CriteriaOperator.Equal, currentUser.ID));
User user = DataContext.Load<User>(q);
...
}
I'm getting 2 compiler errors on the '.Load(q)' line
Error 34 The best overloaded method match for 'myApp.DataAccess.IDataContext.Load(int)' has some invalid arguments ...Facade\UserFacade.cs 100 25 myApp.Business
Error 35 Argument 1: cannot convert from 'myApp.DataAccess.Query' to 'int' ...Facade\UserFacade.cs 100 48 myApp.Business
where the line from the interface looks like:
public interface IDataContext
{
EntityType Load<EntityType>(int ID) where EntityType : class, new();
...
I can clear the error conditions by return a list:
IList<User> user = DataContext.LoadList<User>(q);
and i can work with that list (return user[0].SubscriptionDiscount;) but that doesn't seem right.
Upvotes: 0
Views: 112
Reputation: 52735
Both Cole and binaryhowl explained the problem, but you are complicating things unnecessarily.
session.Load<EntityType>(ID)
or session.Get<EntityType>(ID)
depending on what you really want to accomplish. There's no need for a query when you already know the Id.Upvotes: 0
Reputation: 15313
The interface method you have outlined above takes an integer and you are trying to pass it a Query object. Seems like a pretty cut and dry issue to me.
Upvotes: 1