How To separate database access in .Net Core The Next CEO of Stack OverflowHow do I enumerate an enum in C#?Cross-thread operation not valid: Control accessed from a thread other than the thread it was created onDo zombies exist … in .NET?Why not inherit from List<T>?ConnectionString from appsettings.json in Data Tier with Entity Framework CoreHow do I access Configuration in any class in ASP.NET Core?Consume .Net Core library from .Net standard projectShared data and shared methods in .NET Core RazorHow to get the authenticated user from a separate class library in .Net CoreAuthentication between Projects in .net core
Is it professional to write unrelated content in an almost-empty email?
What flight has the highest ratio of time difference to flight time?
Do I need to write [sic] when a number is less than 10 but isn't written out?
Why isn't acceleration always zero whenever velocity is zero, such as the moment a ball bounces off a wall?
Reference request: Grassmannian and Plucker coordinates in type B, C, D
Chain wire methods together in Lightning Web Components
Domestic-to-international connection at Orlando (MCO)
Missile strike detection (but it's not actually a missile)
Find non-case sensitive string in a mixed list of elements?
Is there always a complete, orthogonal set of unitary matrices?
Why the difference in type-inference over the as-pattern in two similar function definitions?
How to install OpenCV on Raspbian Stretch?
Grabbing quick drinks
Are police here, aren't itthey?
Newlines in BSD sed vs gsed
When you upcast Blindness/Deafness, do all targets suffer the same effect?
Math-accent symbol over parentheses enclosing accented symbol (amsmath)
Solving system of ODEs with extra parameter
Prepend last line of stdin to entire stdin
If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?
Why do remote US companies require working in the US?
Is French Guiana a (hard) EU border?
How many extra stops do monopods offer for tele photographs?
Does soap repel water?
How To separate database access in .Net Core
The Next CEO of Stack OverflowHow do I enumerate an enum in C#?Cross-thread operation not valid: Control accessed from a thread other than the thread it was created onDo zombies exist … in .NET?Why not inherit from List<T>?ConnectionString from appsettings.json in Data Tier with Entity Framework CoreHow do I access Configuration in any class in ASP.NET Core?Consume .Net Core library from .Net standard projectShared data and shared methods in .NET Core RazorHow to get the authenticated user from a separate class library in .Net CoreAuthentication between Projects in .net core
In Webforms you could use an ObjectDataSource, use methods defined in your Business Logic Layer that would get data from your Data Layer, usually a data set or EF. Then all the code accessing database would be all in one place and retrieved logically based on methods.
In .Net Core Razor, how do you organize this?
c# entity-framework asp.net-core asp.net-core-mvc entity-framework-core
add a comment |
In Webforms you could use an ObjectDataSource, use methods defined in your Business Logic Layer that would get data from your Data Layer, usually a data set or EF. Then all the code accessing database would be all in one place and retrieved logically based on methods.
In .Net Core Razor, how do you organize this?
c# entity-framework asp.net-core asp.net-core-mvc entity-framework-core
2
Generally speaking, you just throw it all in a class library. Much more than that I can't say as you haven't provided much information about what you're trying to do.
– Chris Pratt
Mar 21 at 18:22
add a comment |
In Webforms you could use an ObjectDataSource, use methods defined in your Business Logic Layer that would get data from your Data Layer, usually a data set or EF. Then all the code accessing database would be all in one place and retrieved logically based on methods.
In .Net Core Razor, how do you organize this?
c# entity-framework asp.net-core asp.net-core-mvc entity-framework-core
In Webforms you could use an ObjectDataSource, use methods defined in your Business Logic Layer that would get data from your Data Layer, usually a data set or EF. Then all the code accessing database would be all in one place and retrieved logically based on methods.
In .Net Core Razor, how do you organize this?
c# entity-framework asp.net-core asp.net-core-mvc entity-framework-core
c# entity-framework asp.net-core asp.net-core-mvc entity-framework-core
edited Mar 22 at 7:53
ArunPratap
2,35621028
2,35621028
asked Mar 21 at 18:05
JackalJackal
186112
186112
2
Generally speaking, you just throw it all in a class library. Much more than that I can't say as you haven't provided much information about what you're trying to do.
– Chris Pratt
Mar 21 at 18:22
add a comment |
2
Generally speaking, you just throw it all in a class library. Much more than that I can't say as you haven't provided much information about what you're trying to do.
– Chris Pratt
Mar 21 at 18:22
2
2
Generally speaking, you just throw it all in a class library. Much more than that I can't say as you haven't provided much information about what you're trying to do.
– Chris Pratt
Mar 21 at 18:22
Generally speaking, you just throw it all in a class library. Much more than that I can't say as you haven't provided much information about what you're trying to do.
– Chris Pratt
Mar 21 at 18:22
add a comment |
1 Answer
1
active
oldest
votes
.NET Core web apps generally follows the Model View Controller (MVC) pattern, but you can use 'Razor Pages' for simpler apps.
If you're using MVC then in your razor views you should just be displaying data in the model for the view. A model is typically a simple Plain Old C# Object (POCO).
The model is created and populated in the controller from any data source or service.
If you're new to MVC from web forms then this guide on .NET Core MVC should be helpful.
If your app is pretty simple then this guide on Razor Pages might be helpful.
1
I see, i don't know much about MVC yet but i have started using controllers on a razor pages template, basically just mixing stuff around when it's suitable. So I have a controller for my Car model, GetCars Action will just do the db call and populate it. Looks clean and simple
– Jackal
Mar 21 at 18:57
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55286671%2fhow-to-separate-database-access-in-net-core%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
.NET Core web apps generally follows the Model View Controller (MVC) pattern, but you can use 'Razor Pages' for simpler apps.
If you're using MVC then in your razor views you should just be displaying data in the model for the view. A model is typically a simple Plain Old C# Object (POCO).
The model is created and populated in the controller from any data source or service.
If you're new to MVC from web forms then this guide on .NET Core MVC should be helpful.
If your app is pretty simple then this guide on Razor Pages might be helpful.
1
I see, i don't know much about MVC yet but i have started using controllers on a razor pages template, basically just mixing stuff around when it's suitable. So I have a controller for my Car model, GetCars Action will just do the db call and populate it. Looks clean and simple
– Jackal
Mar 21 at 18:57
add a comment |
.NET Core web apps generally follows the Model View Controller (MVC) pattern, but you can use 'Razor Pages' for simpler apps.
If you're using MVC then in your razor views you should just be displaying data in the model for the view. A model is typically a simple Plain Old C# Object (POCO).
The model is created and populated in the controller from any data source or service.
If you're new to MVC from web forms then this guide on .NET Core MVC should be helpful.
If your app is pretty simple then this guide on Razor Pages might be helpful.
1
I see, i don't know much about MVC yet but i have started using controllers on a razor pages template, basically just mixing stuff around when it's suitable. So I have a controller for my Car model, GetCars Action will just do the db call and populate it. Looks clean and simple
– Jackal
Mar 21 at 18:57
add a comment |
.NET Core web apps generally follows the Model View Controller (MVC) pattern, but you can use 'Razor Pages' for simpler apps.
If you're using MVC then in your razor views you should just be displaying data in the model for the view. A model is typically a simple Plain Old C# Object (POCO).
The model is created and populated in the controller from any data source or service.
If you're new to MVC from web forms then this guide on .NET Core MVC should be helpful.
If your app is pretty simple then this guide on Razor Pages might be helpful.
.NET Core web apps generally follows the Model View Controller (MVC) pattern, but you can use 'Razor Pages' for simpler apps.
If you're using MVC then in your razor views you should just be displaying data in the model for the view. A model is typically a simple Plain Old C# Object (POCO).
The model is created and populated in the controller from any data source or service.
If you're new to MVC from web forms then this guide on .NET Core MVC should be helpful.
If your app is pretty simple then this guide on Razor Pages might be helpful.
edited Mar 21 at 18:34
answered Mar 21 at 18:14
Richard GarsideRichard Garside
41.1k86475
41.1k86475
1
I see, i don't know much about MVC yet but i have started using controllers on a razor pages template, basically just mixing stuff around when it's suitable. So I have a controller for my Car model, GetCars Action will just do the db call and populate it. Looks clean and simple
– Jackal
Mar 21 at 18:57
add a comment |
1
I see, i don't know much about MVC yet but i have started using controllers on a razor pages template, basically just mixing stuff around when it's suitable. So I have a controller for my Car model, GetCars Action will just do the db call and populate it. Looks clean and simple
– Jackal
Mar 21 at 18:57
1
1
I see, i don't know much about MVC yet but i have started using controllers on a razor pages template, basically just mixing stuff around when it's suitable. So I have a controller for my Car model, GetCars Action will just do the db call and populate it. Looks clean and simple
– Jackal
Mar 21 at 18:57
I see, i don't know much about MVC yet but i have started using controllers on a razor pages template, basically just mixing stuff around when it's suitable. So I have a controller for my Car model, GetCars Action will just do the db call and populate it. Looks clean and simple
– Jackal
Mar 21 at 18:57
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55286671%2fhow-to-separate-database-access-in-net-core%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Generally speaking, you just throw it all in a class library. Much more than that I can't say as you haven't provided much information about what you're trying to do.
– Chris Pratt
Mar 21 at 18:22