-
Notifications
You must be signed in to change notification settings - Fork 936
NH-2401 - Method for specifying IType of LINQ parameter #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Linq.Expressions; | ||
using System.Reflection; | ||
using NHibernate.Hql.Ast; | ||
using NHibernate.Linq; | ||
using NHibernate.Linq.Visitors; | ||
using NHibernate.Type; | ||
|
||
namespace NHibernate.Linq.Functions | ||
{ | ||
public class MappedAsGenerator : BaseHqlGeneratorForMethod | ||
{ | ||
public MappedAsGenerator() | ||
{ | ||
SupportedMethods = new[] { ReflectionHelper.GetMethodDefinition<object>(x => x.MappedAs(null)) }; | ||
} | ||
|
||
public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor) | ||
{ | ||
var result = visitor.Visit(arguments[0]).AsExpression(); | ||
return result; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,12 @@ namespace NHibernate.Linq | |
{ | ||
public static class LinqExtensionMethods | ||
{ | ||
public static T MappedAs<T>(this T parameter, NHibernate.Type.IType type) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This random thought: can we have different There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like this: public static decimal MappedAs(this decimal parameter, NHibernate.Type.IType type) ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hooray, you've learnt how to use line comments... sorry, just trying to joke.
Probably
But I see now, that this is a bad idea.
Just because (c) my 4yo. Just because we forgot to support it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a specific type, we need to allow passing arbitrary types! BTW, why is that a bad idea? |
||
{ | ||
//NH-2401 | ||
return parameter; | ||
} | ||
|
||
public static IQueryable<T> Query<T>(this ISession session) | ||
{ | ||
return new NhQueryable<T>(session.GetSessionImplementation()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see traces of debugging here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add the logic here?