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

EntitySpaces Studio generates buggy classes for views #6

Open
HeikoAdams opened this issue Jan 7, 2020 · 14 comments
Open

EntitySpaces Studio generates buggy classes for views #6

HeikoAdams opened this issue Jan 7, 2020 · 14 comments

Comments

@HeikoAdams
Copy link

Version 2019.1.1218.0 of EntitySpaces Studio generates buggy code for view clases.

Every generated view class gets at least a constructor which requires a join alias but the GetDynamicQuery or Query methods of the same generated classes are calling a non existing constructor without parameters.

@HeikoAdams
Copy link
Author

This is an example class generated by es studio
ViewReturns.zip

@MikeGriffinReborn
Copy link
Owner

MikeGriffinReborn commented Jan 8, 2020

Oh shoot, I will fix that tonight, I haven't been testing views, easy fix, sorry about that, watch for a fix tonight hopefully

@MikeGriffinReborn MikeGriffinReborn added bug Something isn't working and removed bug Something isn't working labels Jan 8, 2020
@MikeGriffinReborn
Copy link
Owner

Okay, I just generated some Views off my Northwind database, both Custom and Generated classes. They are compiling just fine, I can't tell by just looking at the class you gave me what the issue is. Can your provide me with more information?

@HeikoAdams
Copy link
Author

HeikoAdams commented Jan 9, 2020

What kind of information do need/prefer?

@MikeGriffinReborn
Copy link
Owner

MikeGriffinReborn commented Jan 9, 2020

Okay, I think I see the issue, for some reason their is a weird capitalization issue going on?

For instance ...

public partial class ViewReturns : EsViewReturns
{

}

Notice the "EsViewReturns" .... this should be "esViewReturns ... (lower case "es").

Looking into it. Your custom class is probably inheriting from "esViewReturns" lower case and thus the compiler errors ....

Did you change the prefix in the EntitySpaces Studio "Settings" => "Naming Conventions" tab by chance?

@HeikoAdams
Copy link
Author

Did you change the prefix in the EntitySpaces Studio "Settings" => "Naming Conventions" tab by chance?

Yes, because M$ naming conventions require classnames starting with an upper case letter.

Hint: I'm using the fxcop nuget

@MikeGriffinReborn
Copy link
Owner

Hmmm, well then you must make sure your Custom Class is inheriting from the Es version, you might need to manually change your "Custom" class.

@HeikoAdams
Copy link
Author

Hmmm, well then you must make sure your Custom Class is inheriting from the Es version, you might need to manually change your "Custom" class.

I'll check when I'm back at work tomorrow

@HeikoAdams
Copy link
Author

Okay, I've checked it and the inheritance is correct.

@MikeGriffinReborn
Copy link
Owner

Can you post a cheesy project showing the compiler error or post the compiler error? I simply cannot reproduce this.

@HeikoAdams
Copy link
Author

The view-query class itself doesn't compile with compiler error "there is no constructor which accepts 0 arguments"

@HeikoAdams
Copy link
Author

The class constructor signature is public ViewReturnsQuery(string joinAlias) but at least public ViewReturnsQuery Query creates a new query instance by calling this.query = new ViewReturnsQuery();

@HeikoAdams
Copy link
Author

Okay I figured out that changing line 80 of Generated - Query (C#).est from public <%=source.Query%>(string joinAlias) to public <%=source.Query%>(string joinAlias = "<%=source.Query%>")

@HeikoAdams
Copy link
Author

A fix for this is also part of my pull request #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants