abe545 / CodeOnlyStoredProcedures

A library for easily calling Stored Procedures in .NET using only code (no xml or gui).
MIT License
4 stars 3 forks source link

Support of enums in Table valued parameters #91

Open leevva opened 7 years ago

leevva commented 7 years ago

It seems that it doesn't work when TVP class contains enum. I get exception:

Result Message: System.InvalidCastException : Specified cast is not valid.

Result StackTrace:
at Microsoft.SqlServer.Server.SqlDataRecord.SetValue(Int32 ordinal, Object value) at CodeOnlyStoredProcedure.TableValuedParameter.CrateValuedParameter(IEnumerable table, Type enumeratedType) at CodeOnlyStoredProcedure.TableValuedParameter.CreateDbDataParameter(IDbCommand command) at CodeOnlyStoredProcedure.StoredProcedure.AddParameters(IDbCommand cmd) at CodeOnlyStoredProcedure.StoredProcedure3.Execute(IDbConnection connection, CancellationToken token, Int32 timeout) at CodeOnlyStoredProcedure.StoredProcedure3.Execute(IDbConnection connection, Int32 timeout)

abe545 commented 7 years ago

Hmmm, I could have sworn I've tried that before. Could you provide the signature of the TVP in SQL server, as well as the class you're using to pass it?

Edit: No, you're right: I've tracked this in #41