Hi all,
I have the same problem.
Version used: v3.1 Final (February 22nd, 2012)
I added multiple type shortcut definitions in my project. (see attachment)
One of these shortcuts is Gender, which is an enum.
I also added the stored procedure call SpAddIntegrationNonActiveRequest (see attachment), which uses the type Gender for the parameter Gender. As you can see, this is an optional parameter, with direction InputOutput.
The generated code of this stored procedure call is:
public static int SpAddIntegrationNonActiveRequest(System.DateTime startDate, KSZUtils.Sector sectorID, System.String userRequested, ref System.String iNSZ, ref System.String lastName, ref System.String firstName, ref System.String birthDate, ref Nullable<Constructiv.DataManagement.CrossDB.KSZServices.API.I.GenderEnum> gender, ref System.Int64 stgPersonID, ref Nullable<System.Int64> synergyID, ref System.Int64 integrationNonActiveRequestID, ref System.String errorInfo, IDataAccessCore dataAccessProvider)
{
using(StoredProcedureCall call = CreateSpAddIntegrationNonActiveRequestCall(dataAccessProvider, startDate, sectorID, userRequested, iNSZ, lastName, firstName, birthDate, gender, stgPersonID, synergyID, integrationNonActiveRequestID, errorInfo))
{
int toReturn = call.Call();
iNSZ = call.GetParameterValue<System.String>(0);
lastName = call.GetParameterValue<System.String>(1);
firstName = call.GetParameterValue<System.String>(2);
birthDate = call.GetParameterValue<System.String>(3);
gender = call.GetParameterValue<Nullable<Constructiv.DataManagement.CrossDB.KSZServices.API.I.GenderEnum>>(4);
stgPersonID = call.GetParameterValue<System.Int64>(7);
synergyID = call.GetParameterValue<Nullable<System.Int64>>(8);
integrationNonActiveRequestID = call.GetParameterValue<System.Int64>(9);
errorInfo = call.GetParameterValue<System.String>(11);
return toReturn;
}
}
The System.InvalidCastException happens here:
gender = call.GetParameterValue<Nullable<Constructiv.DataManagement.CrossDB.KSZServices.API.I.GenderEnum>>(4);
This happens although the value of this parameter is valid.
When modifying the parameter to be required and not optional (and thus not Nullable), there seems to be no problem.