Giter VIP home page Giter VIP logo

samplemvcwebapp's Introduction

SampleMvcWebApp

SampleMvcWebApp is a ASP.NET MVC5 web site designed to show number of useful methods for building enterprise grade web applications using ASP.NET MVC5 and Entity Framework 6. The code for this sample MVC web application, and the associated GenericServices Framework are both an open source project by Jon Smith under the MIT licence.

This code is available as a live web site which includes explanations of the code - see an example of this on the Posts code explanation page.

The GenericService Framework is available on GitHub and soon via NuGet (when the release is stable).

GenericServices is now available on NuGet. See NuGet Package Page for more details.

An additinal, more complex example is now available. Visit Complex.SampleMvcWebApp to see more.

The specific features in the code in this example are:

1. Simple, but robust database services

Database accesses are normally a big part of enterprise systems build with APS.NET MVC. However, my experience is that creating these services in a robust and comprehensive form can lead to a lot of repetative code that does the same thing, but for different data. My aim has been to produce a generic framework that handles most of the cases, and is easily extensible when special handling is required. Examples of there use on this web site are:

1. Use of Dependency Injection

The GenericService framework is designed specifically to work with Dependency Injection (DI). DI is used throughout this web site, but specific examples are:

  • Inserting the required services into a controller by action parameter injection.
  • DI is also used for creating the GenericService etc. See Code Explanation for more information.

Note that the SampleMvcWebApp uses AutoFac dependency injection framework, but the framework allows you to replace AutoFac with your own favourite DI tool.

samplemvcwebapp's People

Contributors

jonpsmith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samplemvcwebapp's Issues

Question regarding the business layer

Hi Jon

You mention in your GenericServices milestones, that you removed the Action methods, as to make it all about database access. The business logic should go into a seperate library.

Could you briefly explain how you would recommend structuring the project to use a business layer together with GenericServices?

When I download this app, a root folder BizLayer & a class library exist, but is not included in the solution. Would I add this class library to the solution & input any business processes into there? For example if I have a workflow where the user edits the state of DTO object in the UI, which is persisted in the database, how would you recommend I include this workflow process into the existing solution structure?

Thanks

Missing nuget GenericServices and GenericSecurity

Great work and example! I am missing these two libraries. Cant find GenericServices in nuget and GenericSecurity.

I downloaded GenericServices and reference manually (not nuget) but GenericSecurity is cannot resolve.

Please help, when you get a chance.

Thanks
Roel

Missing version 1.0.0 GenericLibsBase from Nuget

Hi Jon,

I just downloaded the sample and attempted a build and Nuget was unable to find 1.0.0 version of GenericLibsBase from VS2013 Premium edition. I noticed there was a change a day or so ago maybe this caused it somehow?

Thanks
Allan

Removed individual accounts from SampleMvcWebApp

Hi @riffrack,

You mentioned a few weeks ago that SampleMvcWebApp has individual account running in the App. I realised that was from a former usage of SampleMvcWebApp and isn't needed any more. I therefore removed the code and turned that feature off because it a) could confuse people and b) it created a accounts database for no reason.

Registering services as Singleton

How do you register services as singleton or transient scoped? I have the need to load certain dto as singleton so every controller simply gets the same values. I thought about using a base controller but base controller loading data just does not seem like the way to go if there are many dtos I want to load - thereby injecting a lot of services which may or may not be needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.