GithubHelp home page GithubHelp logo

Comments (9)

ErikEJ avatar ErikEJ commented on June 4, 2024

@spaasis Yes, it looks like an ommision from when the Interface class was introduced. A PR? 😄

from efcorepowertools.

spaasis avatar spaasis commented on June 4, 2024

@ErikEJ Alright, I'll attempt a fix. Now I know where to look ;)

from efcorepowertools.

spaasis avatar spaasis commented on June 4, 2024

@ErikEJ Setting the actual annotation is simple enough, but how should this thing actually work..

If I have a proc with:

CREATE PROCEDURE [dbo].[USP_MyProc]
				@MyParam varchar(50) = NULL,

Then the generated interface is
Task<List<USP_MyProcResult>> USP_MyProcAsync(string MyParam, CancellationToken cancellationToken = default);

Note that string MyParam is not string? so the nullability of the param is currently not correctly set.
Is this a bug or intended behavior?

If it's intended, we could always set #nullable disable to signify that all parameters are nullable by default.

from efcorepowertools.

spaasis avatar spaasis commented on June 4, 2024

And the implementation of the above proc:

            var parameterreturnValue = new SqlParameter
            {
                ParameterName = "returnValue",
                Direction = System.Data.ParameterDirection.Output,
                SqlDbType = System.Data.SqlDbType.Int,
            };

            var sqlParameters = new []
            {
                    ParameterName = "MyParam",
                    Size = 50,
                    Value = MyParam ?? Convert.DBNull,
                    SqlDbType = System.Data.SqlDbType.VarChar,
                },

from efcorepowertools.

ErikEJ avatar ErikEJ commented on June 4, 2024

Good question - all paramters are always nullable.

from efcorepowertools.

spaasis avatar spaasis commented on June 4, 2024

@ErikEJ okay, so it should be sufficient then to just hardcode the #nullable disable in these two files. I'll have a PR up soon

from efcorepowertools.

ErikEJ avatar ErikEJ commented on June 4, 2024

Correct

from efcorepowertools.

ErikEJ avatar ErikEJ commented on June 4, 2024

Wonder why no one else has reported this?

from efcorepowertools.

spaasis avatar spaasis commented on June 4, 2024

I wondered about the same thing.. Possibly the combination of nullable reference types + stored procs is rare?

from efcorepowertools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.