.NET8 Blazor Auto Render Mode - How to prevent sending DataPortal code to client? #4158
Unanswered
MarkOverstreet
asked this question in
Questions
Replies: 2 comments 2 replies
-
Good Question. I do a similar thing with business object and a separate data access layer.
Kevin
…________________________________
From: Mark Overstreet ***@***.***>
Sent: Monday, August 12, 2024 8:20 AM
To: MarimerLLC/csla ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [MarimerLLC/csla] .NET8 Blazor Auto Render Mode - How to prevent sending DataPortal code to client? (Discussion #4158)
Our goal is to keep the data access code off of the wasm client because we have an app that has ADO.NET code directly in the business object that inherits from BusinessBase. In .NET6, we accomplished this by having our business object split between two files as a partial class. The domain class contained the properties, business rules, etc. while the dataportal.cs class contained the Fetch, Insert, Update, etc. with ADO.NET. When compiling the data portal project, it included both files; however, when compiling the WASM project, it ignored any file ending with "dataportal.cs". This worked great since the client never actually uses the local data portal but instead calls into the remote data portal.
EX:
Gift.cs
Gift.dataportal.cs
In .NET8, you build one project to publish which is the server project it handles building the all the referenced projects including the wasm project and now our previous approach does not work. How are others accomplishing this currently? Any suggestions on how to accomplish this?
Thanks
Mark
—
Reply to this email directly, view it on GitHub<#4158>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGJTVDXRFZBNN25IMYGJURLZRDAEHAVCNFSM6AAAAABMMJDH6WVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXGA2DKMJRGU>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Mark, We do this by breaking out the ADO.NET code into a separate class library that implements a DAL interface. So we have these projects:
In your scenario, you may be able to use compiler directives in your code like [UnsupportedOSPlatform("browser")]. Csla uses this in the DataPortalClient code. We have not tried this so let us know what you find out. `#if NET8_0_OR_GREATER }` Hope this helps! Ben |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Our goal is to keep the data access code off of the wasm client because we have an app that has ADO.NET code directly in the business object that inherits from BusinessBase. In .NET6, we accomplished this by having our business object split between two files as a partial class. The domain class contained the properties, business rules, etc. while the dataportal.cs class contained the Fetch, Insert, Update, etc. with ADO.NET. When compiling the data portal project, it included both files; however, when compiling the WASM project, it ignored any file ending with "dataportal.cs". This worked great since the client never actually uses the local data portal but instead calls into the remote data portal.
EX:
Gift.cs
Gift.dataportal.cs
In .NET8, you build one project to publish which is the server project it handles building the all the referenced projects including the wasm project and now our previous approach does not work. How are others accomplishing this currently? Any suggestions on how to accomplish this?
Thanks
Mark
Beta Was this translation helpful? Give feedback.
All reactions