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

Oqtane - Strong typed data in Html.Partial fails with error CS0246: The type or namespace name 'x' could not be found #3479

Closed
enfJoao opened this issue Oct 5, 2024 · 7 comments
Assignees

Comments

@enfJoao
Copy link

enfJoao commented Oct 5, 2024

I'm submitting a

[x] bug report
[x] not sure

...about

[x] Razor templating
[x] other / unknown

Current Behavior / Expected Behavior

This is a working code from a DNN app

Template A:

@inherits Custom.Hybrid.RazorTyped
@using AppCode
@using AppCode.Data

@Html.Partial("shared/_B.cshtml", new { Units = true, Years = true, Months = true })

Template B:

@inherits Custom.Hybrid.RazorTyped

@{
    var tUnits = App.Data.GetAll<zDepartments>()
 }

Results in CS0246: The type or namespace name 'zDepartments' could not be found

Adding

@using AppCode
@using AppCode.Data

to Template B results in CS0234: The type or namespace name 'Data' does not exist in the namespace 'AppCode'

Your environment

  • 2sxc version(s): 18.01.00
  • Oqtane: 5.2.3
  • Hosting platform: IIS
@iJungleboy
Copy link
Contributor

This can't work. What should x be?

The correct setup would have a class like BlogPost in the AppCode.Data.

Then your file B would look like this:

@inherits Custom.Hybrid.RazorTyped
@using AppCode
@using AppCode.Data

@{
    var tB= App.Data.GetAll<BlogPost>();
 }

@enfJoao
Copy link
Author

enfJoao commented Oct 7, 2024

Sorry. When copying the code from my template I abbreviated too much. "x" is my datatype, so BlogPost for example.

Everything else is still valid.
The class exists:
image

@enfJoao
Copy link
Author

enfJoao commented Oct 7, 2024

Updated the original example.

@enfJoao
Copy link
Author

enfJoao commented Oct 7, 2024

To clarify:

Template A:

@inherits Custom.Hybrid.RazorTyped
@using AppCode
@using AppCode.Data

@Html.Partial("shared/_B.cshtml", new { Units = true, Years = true, Months = true })

Template B:

@inherits Custom.Hybrid.RazorTyped
@using AppCode
@using AppCode.Data

@{
    var tUnits = App.Data.GetAll<zDepartments>()
 }

Results in CS0234: The type or namespace name 'Data' does not exist in the namespace 'AppCode'

@iJungleboy
Copy link
Contributor

Ok.
I know you're coming from DNN - but above you wrote Oqtane.

We might have a bug in the AppCode in Oqtane, which @tvatavuk is looking into.

Can you confirm that ATM you're working in Oqtane?

@enfJoao
Copy link
Author

enfJoao commented Oct 7, 2024

Yes. I picked a DNN app and I'm trying to make it work in Oqtane. The current issue is in Oqtane.

@tvatavuk
Copy link
Contributor

tvatavuk commented Oct 7, 2024

Thank you for reporting this issue! We identified that inconsistent path formatting was causing the problem, which has now been addressed by ensuring uniform path formatting for reliable comparisons. This fix will be included in the next release.

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

No branches or pull requests

3 participants