Skip to content
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

ObjectParameter null string values #59

Closed
TimSirmovics opened this issue Jun 22, 2016 · 3 comments
Closed

ObjectParameter null string values #59

TimSirmovics opened this issue Jun 22, 2016 · 3 comments

Comments

@TimSirmovics
Copy link
Contributor

TimSirmovics commented Jun 22, 2016

Object Parameters are generated for functions using the (string name, object value) constructor:

var exampleParam = new System.Data.Entity.Core.Objects.ObjectParameter("ExampleParam", exampleParamValue);

When an optional string parameter is null, this throws an exception in the constructor of ObjectParameter even though it is legal and neccesary to have a null value for this parameter.

This StackOverflow answer suggests using the alternative constructor, and setting the Value parameter after construction:

var exampleParam = new System.Data.Entity.Core.Objects.ObjectParameter("ExampleParam", typeof(string)) { Value = exampleParamValue }

Could this be incorporated into the generator?

@sjh37
Copy link
Owner

sjh37 commented Jun 22, 2016

I have modified WriteTableValuedFunctionDeclareSqlParameter.
Can you pull the latest code and check this ok

@TimSirmovics
Copy link
Contributor Author

Perfect.

@sjh37
Copy link
Owner

sjh37 commented Jun 23, 2016

Great. Thanks for your help. This will be in the next release.

@sjh37 sjh37 closed this as completed Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants