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

DbModelBuilder.Entity<TEntity>().MapToStoredProcedures() creates an empty procedure [DNET708] #659

Closed
firebird-automations opened this issue Oct 20, 2016 · 4 comments

Comments

@firebird-automations
Copy link

Submitted by: Charles J Christie II (sonicbhoc)

I attempted to map my entities as procedures in the model builder. I then went to test my database and, upon calling SaveChanges on my context, I got the following exception:
"Dynamic SQL Error
SQL error code = -84
procedure Address_Insert does not return any values
At line 1, column 15"

I opened the database using DBeaver and loaded the code used for the generated stored procedure:
CREATE OR ALTER PROCEDURE Address_Insert ("FirstName" VARCHAR(100), "LastName" VARCHAR(100), "AttnLine" VARCHAR(100), "Line1" VARCHAR(255), "Line2" VARCHAR(255), "City" VARCHAR(50), "State" VARCHAR(50), "Zip" VARCHAR(10), "Country" VARCHAR(53), "Job_Id" INTEGER, "Profile_Id" INTEGER)
AS
BEGIN

END

And in the migration:
CreateStoredProcedure(
"dbo.Address_Insert",
p => new
{
FirstName = p.String(maxLength: 100),
LastName = p.String(maxLength: 100),
AttnLine = p.String(maxLength: 100),
Line1 = p.String(maxLength: 255),
Line2 = p.String(maxLength: 255),
City = p.String(maxLength: 50),
State = p.String(maxLength: 50),
Zip = p.String(maxLength: 10),
Country = p.String(maxLength: 53),
Job_Id = p.Int(),
Profile_Id = p.Int(),
},
body: ""
);

All of the generated stored procedures have the same problem. They're all completely blank.
For now I won't use them. I'd suggest that if you don't want to implement this functionality any time soon, that you make it throw a NotImplementedException if you can, or have it prominently shown in your documentation that it doesn't do anything. Thank you.

@firebird-automations
Copy link
Author

Commented by: @cincuranet

You have there `body: "" `, so empty body. Thus it's correctly generated.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Author

Commented by: Charles J Christie II (sonicbhoc)

The docs for EF said that rudimentary stored procedures that you could modify if necessary would be generated if you call MapStoredProcedures. That didn't happen when I called it using this library, so I assumed it was a bug.
https://msdn.microsoft.com/en-us/data/dn468673.aspx

@firebird-automations
Copy link
Author

Commented by: @cincuranet

If you want to use generated statements don't use SPs. Otherwise you have to provide the body.

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