Coder Social home page Coder Social logo

genericapi's People

Contributors

stevenknox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

bubdm

genericapi's Issues

Input and ViewModel support

Currently API Get/Post/Put all work directly against the model.

We should provide the ability to specify an input and/or view model and have dynamic mapping to and from the domain model.

Suggested approach could be to follow convention over configuration and scan the registered assemblies for files suffixed with InputModel.cs or ViewModel.cs.

  • Product.cs
  • ProductViewModel.cs
  • ProductInputModel.cs

If a match for any of the files is found it will use those for Input and ViewModel rather than the Model itself.

We can possibly add a configure method to allow inclusion or exclusion of Models from this convention.

services.AddMvc()
`.AddGenericControllers(options => 
    { 
	EntityAssembly = nameof(StoreWebApi); 
	UseViewModels = true; 
	UseInputModels = true;
	});

app.ConfigureGenericControllers{
    IgnoreViewModelsFor(Model.Orders)
}

Pluggable Persistence

Persistence is currently Entity Framework only however when registering services in Startup we should allow the option to select a persistence type such as Entity Framework, RavenDB, InMemory etc

Input Sanitization

Provide Sanitize attribute that can be enabled/disabled.

Service to Sanitize should be injectable from Startup.cs to allow use of any library such as Ganss.XSS

Dynamic MVC View

  • Load Model directly or define VM using convention
  • List / Create / Uodate and Delete Actions supported

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.