i am upgrading nhibernate 2.1.2.GA to 3.3.3.GA version
but i found exception is for the enum will be convert to int where i
execute the iquery
here is my code,
public enum EstimateType {
FullyItemized,
UnitPriceJob
}
public IList<IEstimate> GetEstimates(List<EstimateType> argEstimateTypeList,
StringCriteria argProjectName, StringCriteria argEstimateNumber, StringCriteria
argJobNumber) {
StringBuilder aQuery = new StringBuilder();
aQuery.Append("select est from Estimate est ");
WhereBuilder aWhereBuilder = new
WhereBuilder(WhereBuilderType.Where, WhereBuilderJoin.And);
aWhereBuilder.AddCondition(" est.plEstimateType in
(:argEstimateTypeList) ");
aWhereBuilder.AddCondition(GetStringCriteriaQuery(argProjectName,
"est.plProjectName"));
aWhereBuilder.AddCondition(GetStringCriteriaQuery(argEstimateNumber,
"est.plEstimateNumber"));
aWhereBuilder.AddCondition(GetStringCriteriaQuery(argJobNumber,
"est.plJobNumber"));
aQuery.Append(aWhereBuilder.ToString());
IQuery anNhibernateQuery =
SessionManager.GetSession().CreateQuery(aQuery.ToString())
.SetParameterList("argEstimateTypeList", argEstimateTypeList);
return anNhibernateQuery.List<IEstimate>();
}
I got an exception on return anNhibernateQuery.List<IEstimate>();
if I change the code and specify the EnumStringType, it wokrs
.SetParameterList("argEstimateTypeList", argEstimateTypeList, new
NHibernate.Type.EnumStringType<EstimateType>());
Unfortunately, I have too many Enum type and classes if i need to modify the
codes like that....
So is it possible to configure to set Convert Enum type to EnumStringType as
default? from the app.config or somewhere I can inject the convert codes ?
Thank you very much
Arthur
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.