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










1















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?










share|improve this question



















  • 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















1















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?










share|improve this question



















  • 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













1












1








1








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?










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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












  • 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












1 Answer
1






active

oldest

votes


















1














.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.






share|improve this answer




















  • 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












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
);



);













draft saved

draft discarded


















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









1














.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.






share|improve this answer




















  • 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














.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.






share|improve this answer




















  • 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








1







.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.






share|improve this answer















.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.







share|improve this answer














share|improve this answer



share|improve this answer








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













  • 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




















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현