c# - solution architecture for an OData / Web API based .Net project -
so far in office have developed number of small , medium sized .net web based applications used architect them -
- web layer (.net web apis)
- controllers, filters
- services (contains business logic)
- iservices
- repository (gets data database using entity framework / ado.net)
- irepository
- viewmodel
- model
i used have different projects each of listed above in solution.
but moving towards odata web apis , trying away entity framework. bit confused how solution architecture should like.
question 1 - should dbcontext file located?
question 2 - how going query using odata controller -> service -> repository
question 3 - can still follow architectural model given above , have odata instead of entity framework getting data database?
question 4 - still need separate business logic layer (service layer) between data source , controllers can keep controllers thin possible
please excuse if asking wrong/silly question since first effort trying figure out how can use odata perform tasks.
following details of in our project, if can extent. have web api services, have api controllers, used json serialize end result. following important layers , respective roles:
web api controller
- receives rest request, serialize / de-serialize / c# objects
bl (business layer)
- business processing , external service integration (like web services)
helper layer
- in memory processing convert simple data entities / poco's complex ui / return entities, converted json. layer has lot of linq objects code task well. has fair amount of logic.
- repository layer
- fetching simple data entities,
ienumerable<t>
, using our custom micro orm. specific cases fetch datatable / dataset directly , use them further processing
- fetching simple data entities,
- ado helper (custom micro-orm)
- use reflection fill poco @ runtime, using datareader or dataadapter, part can replaced other dtaa fetch mechanism
common entities: (they can accessed across layers defined above, though restrict ensure consistency)
data - simple poco classes, fills db data
ui - final result entity
input - input rest call
constants - hard coding , constant values across project
all c# layers below web api can created dll, since relation unidirectional, bl - helper - repository - ado helper. additional layer specific purpose can inserted or adjusted. important separate specific role of each entity.
Comments
Post a Comment