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

PLINQO EF: Stored Procedures FunctionImport is not generating object context call #583

Closed
GoogleCodeExporter opened this issue Aug 3, 2015 · 33 comments

Comments

@GoogleCodeExporter
Copy link

There is a bit of the luck of support for stored procedures in current version, 
generally would be great to have the same as in PLINQO L2S.

Original issue reported on code.google.com by kachalkov on 6 May 2011 at 2:01

@GoogleCodeExporter
Copy link
Author

Hello,

Could you please provide a little bit more context on not generating object 
context call? I'm not completely following you. Do you have a quick 
sample/snippet you could paste in here.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 9 May 2011 at 6:08

  • Changed state: AwaitingInfo
  • Added labels: Framework-PLINQOEF, Type-Enhancement

@GoogleCodeExporter
Copy link
Author

with EF to be able to call stored procedure we need to Import function and 
generate new entity or use existing.

PLINQO EF should generate call for the imported stored procedure as well as new 
complex type.

At the moment there is no support for that as well this one cause errors:
<Parameter Name="RETURN_VALUE" Mode="Out" Type="int" />

Error 2055: Storage function has a parameter 'RETURN_VALUE' but no 
corresponding parameter was found in the FunctionImport.


Original comment by kachalkov on 10 May 2011 at 1:30

@GoogleCodeExporter
Copy link
Author

Original comment by bniemyjski on 10 May 2011 at 6:56

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

Hello,

I just wanted to follow up and add that I have fixed this bug but am also 
working on getting stored procedure generation working as well :-).

Thanks
-Blake

Original comment by bniemyjski on 11 May 2011 at 5:16

@GoogleCodeExporter
Copy link
Author

This issue was updated by revision r2173.

Fixed a bug where the View Query Extensions would not be generated.
Added support for generating and managing Stored procedures.

Original comment by bniemyjski on 13 May 2011 at 1:16

@GoogleCodeExporter
Copy link
Author

This has been fixed in the latest nightly build. Please download the latest 
nightly build to resolve this issue.

Original comment by bniemyjski on 13 May 2011 at 1:17

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

It's generating complex types now for stored procedures and I'm able to compile 
the project, but edmx is not viewable in the designer any more and I get the 
100 errors like this during the build:

Error   28  Error 2054: A FunctionImport is mapped to a storage function 
'ACSStreamJobsModel.Store.MedianUAI' that can be composed. Only stored 
procedure functions may be 
mapped. D:\Temp\WebCertEF\WebCert.Data\ACSStreamJobs.edmx   13805   13809   WebCert.Da
ta


There are no calls for stored procedures in data context as well.

And the following 100 errors appears when we try to run web site:

Schema specified is not valid. Errors: 
The type doesn't have any key members. A RelationshipType or EntityType must 
either have key members or a BaseType with key members.

It would be really nice guys if you can test it on something like Nortwhind or 
our database schema.

Thank you.

Original comment by kachalkov on 13 May 2011 at 7:46

@GoogleCodeExporter
Copy link
Author

Call for the sql functions are generated...

Original comment by kachalkov on 13 May 2011 at 7:56

@GoogleCodeExporter
Copy link
Author

Original comment by bniemyjski on 18 May 2011 at 6:49

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

This issue was updated by revision r2178.

PLINQO EF: Stored Procedures FunctionImport is not generating object context 
call

Original comment by bniemyjski on 19 May 2011 at 3:59

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Hello,

It appears I was generating off an older schema of yours on my other machine 
and didn't run into this behavior (not sure). We make sure that we test 
extensively before each official template release. I've double checked that the 
latest templates work against your schema. Thanks again for your cooperation 
and time.

 I've made quite a few changes and added lots of extra validation to ensure that everything is generated correctly. Please remove the generated complextype's from your project and regenerate (In the previous nightly build they were generated for every stored procedure, which shouldn't happen if the stored procedure only returns an int RETURN_VALUE).

Please let us know how the changes work out for you.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 19 May 2011 at 4:09

@GoogleCodeExporter
Copy link
Author

Thanks, Blake.

I've just tried latest build and got the following error:


Error   1   Error 2091: The property 'Schoolcode' in the ReturnType 'Cert62Result' 
of the FunctionImport 'Cert62' is 
invalid.    D:\Temp\WebCertEF\WebCert.Data\ACSStreamJobs.edmx   17820   17  WebCert.Data

Original comment by kachalkov on 19 May 2011 at 8:45

@GoogleCodeExporter
Copy link
Author

and the following when running web site:

The number of members in the conceptual type 'WebCert.Data.VETCertificate' does 
not match with the number of members on the object side type 
'WebCert.Data.VETCertificate'. Make sure the number of members are the same.

Description: An unhandled exception occurred during the execution of the 
current web request. Please review the stack trace for more information about 
the error and where it originated in the code. 

Exception Details: System.Data.MappingException: The number of members in the 
conceptual type 'WebCert.Data.VETCertificate' does not match with the number of 
members on the object side type 'WebCert.Data.VETCertificate'. Make sure the 
number of members are the same.

Source Error: 


Line 21:         // Note: Make sure that you change "YourDataContextType" to 
the name of the data context
Line 22:         // class in your application.
Line 23:         
DefaultModel.RegisterContext(typeof(WebCert.Data.WebCertDataContext), new 
ContextConfiguration() { ScaffoldAllTables = false });
Line 24: 
Line 25:         // The following statement supports separate-page mode, where 
the List, Detail, Insert, and 

Source File: d:\Temp\WebCertEF\WebCert.Web\Global.asax    Line: 23 

Stack Trace: 


[MappingException: The number of members in the conceptual type 
'WebCert.Data.VETCertificate' does not match with the number of members on the 
object side type 'WebCert.Data.VETCertificate'. Make sure the number of members 
are the same.]
   System.Data.Mapping.DefaultObjectMappingItemCollection.ValidateAllMembersAreMapped(StructuralType cdmStructuralType, StructuralType objectStructuralType) +385
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadEntityTypeOrComplexTypeMapping(ObjectTypeMapping objectMapping, EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +105
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +153
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadTypeMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +113
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadAssociationTypeMapping(ObjectTypeMapping objectMapping, EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +334
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +172
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadTypeMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +113
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadEntityTypeOrComplexTypeMapping(ObjectTypeMapping objectMapping, EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +459
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +153
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadTypeMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +113
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadAssociationTypeMapping(ObjectTypeMapping objectMapping, EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +334
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +172
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadTypeMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +113
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadEntityTypeOrComplexTypeMapping(ObjectTypeMapping objectMapping, EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +459
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +153
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadTypeMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +113
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadAssociationTypeMapping(ObjectTypeMapping objectMapping, EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +334
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +172
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadTypeMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +113
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadEntityTypeOrComplexTypeMapping(ObjectTypeMapping objectMapping, EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +459
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType edmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection, Dictionary`2 typeMappings) +153
   System.Data.Mapping.DefaultObjectMappingItemCollection.LoadObjectMapping(EdmType cdmType, EdmType objectType, DefaultObjectMappingItemCollection ocItemCollection) +88
   System.Data.Mapping.DefaultObjectMappingItemCollection.TryGetMap(String identity, DataSpace typeSpace, Boolean ignoreCase, Map& map) +494
   System.Data.Mapping.DefaultObjectMappingItemCollection.TryGetMap(String identity, DataSpace typeSpace, Map& map) +18
   System.Data.Mapping.DefaultObjectMappingItemCollection.TryGetMap(GlobalItem item, Map& map) +152
   System.Data.Metadata.Edm.MetadataWorkspace.TryGetObjectSpaceType(StructuralType edmSpaceType, StructuralType& objectSpaceType) +159
   System.Data.Metadata.Edm.MetadataWorkspace.GetObjectSpaceType(StructuralType edmSpaceType) +25
   System.Web.DynamicData.ModelProviders.EFDataModelProvider.GetClrType(EntityType entityType) +20
   System.Web.DynamicData.ModelProviders.EFDataModelProvider.CreateTableProvider(EntitySet entitySet, EntityType entityType) +93
   System.Web.DynamicData.ModelProviders.EFDataModelProvider..ctor(Object contextInstance, Func`1 contextFactory) +810
   System.Web.DynamicData.ModelProviders.SchemaCreator.CreateDataModel(Object contextInstance, Func`1 contextFactory) +124
   System.Web.DynamicData.MetaModel.RegisterContext(Func`1 contextFactory, ContextConfiguration configuration) +374
   System.Web.DynamicData.MetaModel.RegisterContext(Type contextType, ContextConfiguration configuration) +84
   ASP.global_asax.RegisterRoutes(RouteCollection routes) in d:\Temp\WebCertEF\WebCert.Web\Global.asax:23
   ASP.global_asax.Application_Start(Object sender, EventArgs e) in d:\Temp\WebCertEF\WebCert.Web\Global.asax:50

[HttpException (0x80004005): The number of members in the conceptual type 
'WebCert.Data.VETCertificate' does not match with the number of members on the 
object side type 'WebCert.Data.VETCertificate'. Make sure the number of members 
are the same.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +480
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +130
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +198
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +356
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +262

[HttpException (0x80004005): The number of members in the conceptual type 
'WebCert.Data.VETCertificate' does not match with the number of members on the 
object side type 'WebCert.Data.VETCertificate'. Make sure the number of members 
are the same.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +638
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +190

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET 
Version:4.0.30319.225

Original comment by kachalkov on 19 May 2011 at 8:49

@GoogleCodeExporter
Copy link
Author

This issue was updated by revision r2179.

Fixed a bug where a duplicate property would be added to SchemaHelper through a 
view or stored procedure (case sensitive).

Original comment by bniemyjski on 19 May 2011 at 7:00

@GoogleCodeExporter
Copy link
Author

Hello,

I wasn't able to reproduce the second bug (with VETCertificate). It generated 
without error and validated. I added some logic to detect multiple columns with 
the same name and ignore them. This was the cause of the error:

Error   1   Error 2091: The property 'Schoolcode' in the ReturnType 'Cert62Result' 
of the FunctionImport 'Cert62' is 
invalid.    D:\Temp\WebCertEF\WebCert.Data\ACSStreamJobs.edmx   17820   17  WebCert.Data

SELECT
xxx.schoolcode,
......
xxxx2.SchoolCode
FROM

I'd highly recommend changing this column name to avoid future errors and 
confusion of those working with it :). It got me at first until I tracked it 
down.

Original comment by bniemyjski on 19 May 2011 at 7:09

@GoogleCodeExporter
Copy link
Author

It works in PLINQO somehow :)

Original comment by kachalkov on 19 May 2011 at 11:25

@GoogleCodeExporter
Copy link
Author

please try with my csp as I can't reproduce with the fresh one...
It would be really great to have a property in csp for the edmx FileName as 
solution name?
Also, performance now again not good with generating SPs and views...

Original comment by kachalkov on 20 May 2011 at 2:41

Attachments:

@GoogleCodeExporter
Copy link
Author

Cert62 error gone, thanks.

Original comment by kachalkov on 20 May 2011 at 4:37

@GoogleCodeExporter
Copy link
Author

Cert62 error gone, thanks.
And using fresh project generation removed issue with VETCertificate! 
Still would be great to find out what was the issue and how to avoid it to 
happen...

Performance stat:
Done rendering outputs: 3 succeeded, 0 failed, 0 skipped (271023ms).

Original comment by kachalkov on 21 May 2011 at 2:35

@GoogleCodeExporter
Copy link
Author

If I enable generation SPs and Views, add clean expressions as '|se', then I 
get the following validation errors for edmx during the build:

Error   1   Error 2094: The ReturnType 'WebCert.Data.VETGetTPCertificateResult' of 
the FunctionImport 'VETGetTPCertificate' does not exist in the conceptual 
side.   D:\Temp\WebCertEF\WebCert.Data\WebCert.edmx 23758   23770   WebCert.Data

and during design time:

Error   2   Error 11009: Property 'FailedPasswordAnswerAttemptWindowStart' is not 
mapped. D:\Temp\WebCertEF\WebCert.Data\WebCert.edmx 16244   11  WebCert.Data
Error   1   Error 11009: Property 'FailedPasswordAnswerAttemptCount' is not 
mapped. D:\Temp\WebCertEF\WebCert.Data\WebCert.edmx 16243   11  WebCert.Data

Original comment by kachalkov on 21 May 2011 at 7:53

@GoogleCodeExporter
Copy link
Author

VETCertificate error comes back as well...

Original comment by kachalkov on 21 May 2011 at 8:00

@GoogleCodeExporter
Copy link
Author

here is the project file

Original comment by kachalkov on 21 May 2011 at 8:01

Attachments:

@GoogleCodeExporter
Copy link
Author

Original comment by bniemyjski on 24 May 2011 at 2:39

  • Changed state: Investigating

@GoogleCodeExporter
Copy link
Author

Hello,

I'm currently looking into this with the latest nightly build.

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 24 May 2011 at 8:05

@GoogleCodeExporter
Copy link
Author

This issue was updated by revision r2182.

Error   2   Error 11009: Property 'FailedPasswordAnswerAttemptWindowStart' is not 
mapped. 

Original comment by bniemyjski on 25 May 2011 at 10:35

@GoogleCodeExporter
Copy link
Author

Hello,

Could you please try the latest nightly build. I fixed this and another bug 
dealing with sql functions in the latest nightly build.

Also I noticed that the columns starting with Failed... in the 
aspnet_Membership tables were not being generated due to the following ignore 
expression: {temp\#|TEMP}

Thanks
-Blake Niemyjski

Original comment by bniemyjski on 25 May 2011 at 10:38

@GoogleCodeExporter
Copy link
Author

Original comment by bniemyjski on 25 May 2011 at 10:38

  • Changed state: AwaitingInfo

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Hi, it all looks good now, performance is still far away from build in EF 
designer, but I hope you guys can improve that in future, also second 
regeneration is faster.

Had to delete edmx file to get read of:

Error 2094: The ReturnType 'WebCert.Data.VETGetTPCertificateResult' of the 
FunctionImport 'VETGetTPCertificate' does not exist in the conceptual side.

Getting the following error after starting web site:

The number of members in the conceptual type 'WebCert.Data.VETCertificate' does 
not match with the number of members on the object side type 
'WebCert.Data.VETCertificate'. Make sure the number of members are the same.



Original comment by kachalkov on 28 May 2011 at 4:53

@GoogleCodeExporter
Copy link
Author

We are working on the performance updates. Is VETCertificate a table (don't 
have the schema in front of me). Does the conceptual/storage and model have the 
same number of members defined for VETCertificate? If not, which model differs?

Original comment by bniemyjski on 1 Jun 2011 at 5:07

@GoogleCodeExporter
Copy link
Author

I couldn't reproduce this in the latest nightly build. I'm able to view dynamic 
data and the like.. Please check out the latest nightly.

Original comment by bniemyjski on 15 Jun 2011 at 10:50

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Original comment by bniemyjski on 15 Jun 2011 at 11:27

  • Added labels: Version-1.1

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

1 participant