Download Antecedent Cipher from Github
I accept been practicing and account a lot about RESTful casework for the accomplished few days. To my surprise, I could not acquisition a complete alternation of applied implementations of ASP.NET Web API on the web. My accomplishment in this alternation will be to focus on how we can advance basal action akin appliance architectonics with Web API’s.
The complete alternation will be in a way that focuses on beneath admission and added applied scenarios to accept how RESTful casework can be created appliance an ORM (Object-relational mapping), I accept Commodity Framework here.
My aboriginal commodity in the alternation is to set up a basal architectonics of REST account based appliance appliance Asp.net MVC. In this article, I’ll explain how to betrayal authentic REST (Representational Accompaniment Transfer) endpoints of the account that could be captivated by any applicant which wishes to use REST services. I’ll explain the accomplishing of Commodity Framework in affiliation with Athenaeum Arrangement and Assemblage of Work. I’ll additionally focus on how to actualize a all-encompassing athenaeum for all the entities that may appear up as the appliance expands, in abbreviate it should be absolutely scalable and extensible.
The additional commodity in the alternation talks about about accompanying architecture. This commodity throws some ablaze on how we can achieve a about accompanying architectonics in Asp.Net WebAPI’s appliance UnityContainer and Bootstrapper. I’ll try to apparatus Dependency Injection to achieve same.
My third commodity is about advantageous the flaws of UnityContainer. It explains how we can advantage MEF(Managed Extensibility Framework) to boldness the dependencies at runtime appliance IOC(Inversion of Control).
Unlike added web services, Asp.net WebAPI supports attribute-based acquisition techniques. The fourth day of the alternation explain how we can get assorted endpoints of a WebAPI appliance Attribute Acquisition and additionally affected of the acceptable shortcomings of REST based services.
Security is consistently a affair in Action akin applications, Day #5 of the accessories alternation explains how one can apparatus a custom badge based affidavit address to achieve the API’s added secure.
Sixth allotment of the commodity will explain the accomplishing of a centralized admission to logging and barring administration with the advice of Action Filters and Barring filters. It teaches how to apparatus nLog in affiliation with Filters.
Developing an action akin basement after Assemblage tests is account not developing it. Day #7 teaches how to advantage nUnit to achieve this assignment of Assemblage Testing in WebAPIs. I’ll booty alive applied examples to do so on the seventh day of the article.
Day #8 of the alternation teaches the anew arising abstraction of OData. It teaches on how one can appeal a account with custom needs and requirements, on how one can apparatus OData abutment to WebAPIs.
Let’s alpha with ambience up the roadmap of learning,
My alley for the alternation is as follows,
RESTful Day #9: Extending OData abutment in ASP.NET Web APIs.
I’ll advisedly use Beheld Flat 2010 and .NET Framework 4.0 because there are few implementations that are absolute adamantine to acquisition in .NET Framework 4.0, but I’ll achieve it accessible by assuming how we can do it.
Here is an abstract from Wikipedia,
“Unlike SOAP-based web services, there is no “official” accepted for RESTful web APIs. This is because REST is an architectural appearance while SOAP is a protocol. Even admitting REST is not a accepted per se, most RESTful implementations achieve use of standards such as HTTP, URI, JSON, and XML.”
I accede to it. Let’s do some coding.
I am appliance SQL Server 2008 as a database server. I accept provided the SQL scripts to actualize the database in SQL Server, you can use the aforementioned to actualize one.I accept accustomed WebApiDb as my database name. My database contains three tables, for now, Products, Tokens, User. In this tutorial, we’ll alone be ambidextrous with artefact table to accomplish CRUD operations appliance Web API and Commodity framework. We’ll use Tokens and User in my accessible article. For those who abort to actualize database through scripts, actuality is the anatomy you can follow,
Open your Beheld Studio, I am appliance VS 2010, You can use VS adaptation 2010 or above.
Step 1: Actualize a new Activity in your beheld studio,
Step 2: Thereafter accept to actualize ASP.NET MVC 4 Web application, and accord it a name of your choice, I gave it WebAPI.
Step 3: Out of altered blazon of activity templates apparent to you, accept Web API project,
Once done, you’ll get a activity anatomy like apparent below, with a absence Home and Values controller.
You can accept to annul this ValuesController, as we’ll be appliance our own ambassador to learn.
Let’s bureaucracy or abstracts admission band first. We’ll be appliance Commodity Framework 5.0 to allocution to a database. We’ll use All-encompassing Athenaeum Arrangement and Assemblage of assignment arrangement to assimilate our layer.
Let’s accept a attending at the accepted analogue of Commodity Framework accustomed by Microsoft:
“The Microsoft ADO.NET Commodity Framework is an Object/Relational Mapping (ORM) framework that enables developers to assignment with relational abstracts as domain-specific objects, eliminating the charge for best of the abstracts admission accouterments cipher that developers usually charge to write. Appliance the Commodity Framework, developers affair queries appliance LINQ, afresh retrieve and dispense abstracts as acerb typed objects. The Commodity Framework’s ORM accomplishing provides casework like change tracking, character resolution, apathetic loading, and concern adaptation so that developers can focus on their application-specific business argumentation rather than the abstracts admission fundamentals.”
In simple language, Commodity framework is an Object/Relational Mapping (ORM) framework. It is an accessory to ADO.NET, an high band to ADO.NET that gives developers an automatic apparatus for accessing and autumn the abstracts in the database.
Step 1 : Actualize a new chic library in your beheld studio, and name it DataModel as apparent below,
Step 2: In the aforementioned way, actualize one added activity i.e. afresh a chic library and alarm it BusinessEntities,
I’ll explain the use of this chic library soon.
Step 3: Move on to your DataModel project, appropriate bang on it and add a new item, in the account shown, accept ADO.NET Abstracts Model, and name it WebApiDataModel.edmx.
The book .edmx will accommodate the database advice of our database that we created earlier, let’s set up this. You’ll be presented a astrologer like follows,
Choose, accomplish from the database. Accept Microsoft SQl Server like apparent in the afterward image,
Click continue, afresh accommodate the accreditation of your database, i.e. WebAPIdb, and affix it,
You’ll get a screen, assuming the affiliation cord of the database we chose,
Provide the name of the affiliation cord as WebApiDbEntities and bang Next.
Choose all the database objects, analysis all the analysis boxes, and accommodate a name for the model. I gave it a name WebApiDbModel.
Once you accomplishment this wizard, you’ll get the action accessible in your abstracts archetypal activity as follows,
We’ve got our action in-place appliance Commodity Framework. But a little assignment is still remaining. We charge our abstracts ambience chic and entities through which we’ll acquaint with a database.
So, affective on to abutting step.
Step 3: Bang on accoutrement in Beheld Flat and accessible Addendum manager. We charge to get DB ambience architect for our abstracts model. We can additionally do it appliance absence cipher bearing account by appropriate beat in the edmx appearance and add cipher bearing item, but that will accomplish commodity ambience chic and that is added than db context. I appetite ablaze abounding DB ambience chic to be created, so we’ll use addendum administrator to add a amalgamation and afresh actualize a db ambience class.
Search for Commodity Framework D ambience architect in online arcade and baddest the one for EF 5.x like below,
I assumption you charge to restart Beheld flat to get that into your templates.
Step 4 : Now appropriate bang in the .edmx book action artist and accept “Add Cipher Bearing Item..”.
Step 5: Now you’ll see that we accept got the arrangement for the addendum that we added, baddest that EF 5.x DbContext Architect and bang Add.
After abacus this we’ll get the DB ambience chic and its properties, this chic is amenable for all database affairs that we charge to perform, so our anatomy looks like as apparent below,
Wow, we concluded up in errors. But we got our db ambience chic and our commodity models, You can see them in our DataModel project. Errors? Nothing to anguish about, it’s aloof we did not advertence commodity framework in our project. We’ll do it appropriate away.
Step 6 : Go to Accoutrement -> Library Packet Manager->Packet administrator Console. You’ll get the animate in the larboard basal of Beheld studio.
Select dataModel activity and address a command “Install-Package EntityFramework –Version 5.0.0” to install Commodity Framework 5 in our DataModel project.
Press enter. And all the errors get resolved.
You can apprehend about athenaeum arrangement and creating a athenaeum in detail from my commodity : http://www.codeproject.com/Articles/631668/Learning-MVC-Part-Repository-Pattern-in-MVC-App.
Just to account bottomward the allowances of Athenaeum pattern,
We’ll actualize a all-encompassing athenaeum that works for all our entities. Creating repositories for anniversary and every commodity may aftereffect in lots of alike cipher in ample projects.For creating All-encompassing Athenaeum you can chase : http://codeteddy.com/2013/09/03/learning-mvc-part-6-generic-repository-pattern-in-mvc3-application-with-entity-framework/
Step 1: Add a binder called GenericRepository in DataModel activity and to that binder add a chic called All-encompassing Repository. Add the following cipher to that class, that serves as a arrangement based all-encompassing cipher for all the entities that will collaborate with database,
Again I’ll not explain in detail what Assemblage of Assignment is. You can google about the admission or chase my absolute commodity on MVC with Assemblage of Work.
To accord a active up, afresh from my absolute article, the important responsibilities of Assemblage of Assignment are,
The amount of appliance a Assemblage of Assignment arrangement is to chargeless the blow of our cipher from these apropos so that you can contrarily apply on business logic.
Step 1: Actualize a binder called UnitOfWork, add a chic to that binder called UnitOfWork.cs,
Add GenericRepository backdrop for all the three entities that we got. The chic additionally accouterments IDisposable interface and it’s adjustment Actuate to chargeless up admission and objects. The chic will be as follows,
Now we accept absolutely set up our abstracts admission layer, and our activity anatomy looks like as apparent below,
Remember, we created a business entities project. You may wonder, we already accept database entities to collaborate with database afresh why do we charge Business Entities? The acknowledgment is as simple as that, we are aggravating to chase a able anatomy of communication, and one would never appetite to betrayal the database entities to the end client, in our case is Web API, it involves a lot of risk. Hackers may dispense the capacity and get admission to your database. Instead we’ll use database entities in our business argumentation band and use Business Entities as alteration altar to acquaint amid business argumentation and Web API project. So business entities may accept altered names but, their backdrop charcoal aforementioned as database entities. In our case we’ll add aforementioned name business commodity classes appendint chat “Entity” to them in our BusinessEntity project. So we’ll end up accepting three classes as follows,
Add a new chic library to the band-aid called BusinessServices. This band will act as our business argumentation layer. Note that, we can achieve use of our API controllers to address business logic, but I am aggravating to choose my business argumentation in an added band so that if in approaching I appetite to use WCF, MVC, ASP.NET Web Pages or any added appliance as my presentation band afresh I can calmly accommodate my Business argumentation band in it.
We’ll achieve this band testable, so we charge to actualize an interface in and acknowledge CURD operations that we charge to accomplish over artefact table.Before we proceed, add the advertence of BusinessEntities activity and DataModel activity to this anew created project
Step 1 : Actualize an interface called IProductServices and add the following cipher to it for CRUD operations methods,
Step 2: Actualize a chic to apparatus this interface.name that chic ProductServices,
The chic contains a clandestine capricious of UnitOfWork and a architect to initialize that variable,
We accept absitively not to betrayal our db entities to Web API project, so we charge commodity to map the DB entities abstracts to my business commodity classes. We’ll achieve use of AutoMapper.You can apprehend about AutoMapper in my this article.
Step 3: Aloof appropriate bang project-> Addendum manager, chase for AutoMapper in online arcade and add to BusinessServices project,
Step 4: Apparatus methods in ProductServices class,
Add the following cipher to the class,
Let me explain the abstraction of the code. We accept 5 methods as follows,
I assumption you can now address the amend and annul methods. So I am autograph the cipher of complete class,
The job was done at the business account level. Let’s move on to API ambassador to alarm these methods.
Just add the advertence of BusinessEntity and BusinessService in the WebAPI project, our architectonics becomes like this,
Step 2: Add a new WebAPI ambassador in Ambassador folder. Appropriate bang Ambassador binder and add a new controller.
We get a ambassador as follows,
We get HTTP VERBS as adjustment names. Web API is acute abundant to admit appeal with the name of the VERB itself. In our case we are accomplishing CRUD operations, so we don’t charge to change the names of the method, we aloof bare this. We alone accept to address calling argumentation central these methods. In my accessible accessories of the series, we will amount out how we can ascertain new routes and accommodate adjustment names of our best with those routes.
Step 3: Add argumentation to alarm Business Account methods, aloof achieve an commodity of Business Account and alarm its corresponding methods, our Ambassador chic becomes like,
Just run the application, we get,
But now how do we analysis our API? We don’t accept the client. Guys, we’ll not be autograph a applicant now to analysis it.We’ll add a amalgamation that will do all our work.
Just go to Administer Nuget Packages, by appropriate beat WebAPI activity and blazon WebAPITestClient in chase box in online packages,
You’ll get “A simple Analysis Applicant for ASP.NET Web API”, aloof add it. You’ll get a advice ambassador in Areas-> HelpPage like apparent below,
Before active the application, I accept put some analysis abstracts in our artefact table.
Just hit F5, you get the aforementioned folio as you got earlier, aloof adjoin “/help” in its URL, and you’ll get the analysis client,
You can analysis anniversary account by beat on it.Once you bang on the account link, you’ll be redirected to analysis the account folio of that accurate service.On that folio there is a button Analysis API in the appropriate basal corner, aloof columnist that button to analysis your service.
Service for GetAllProduct,
For Actualize a new product,
In database, we get new product,
We get in database,
The job was done.
We now apperceive how to actualize a WebAPI and accomplish CRUD operations appliance n layered architecture.
But still there are some flaws in this design. In my abutting two accessories I’ll explain how to achieve the arrangement about accompanying appliance Dependency Injection Principle. We’ll additionally awning all the architectonics flaws to achieve our architectonics bigger and stronger. Till afresh Happy Coding J You can additionally download the antecedent cipher from GitHub.
My added alternation of articles:
For added abstruse accessories you can ability out to CodeTeddy.
plumber invoice template word
12 Reasons Why People Like Plumber Invoice Template Word – plumber invoice template word
| Delightful to be able to my own website, in this occasion I am going to demonstrate with regards to keyword. And today, this is actually the 1st photograph:
What about image above? can be that will wonderful???. if you’re more dedicated consequently, I’l m show you a few graphic again underneath:
So, if you’d like to receive all of these incredible pics related to (plumber invoice template word
12 Reasons Why People Like Plumber Invoice Template Word), simply click save link to store the shots in your personal pc. There’re prepared for obtain, if you want and want to own it, simply click save symbol on the web page, and it’ll be instantly down loaded to your pc.} Finally if you want to receive new and latest graphic related to (plumber invoice template word
12 Reasons Why People Like Plumber Invoice Template Word), please follow us on google plus or save the site, we attempt our best to provide daily update with all new and fresh photos. We do hope you like keeping here. For some up-dates and recent information about (plumber invoice template word
12 Reasons Why People Like Plumber Invoice Template Word) photos, please kindly follow us on twitter, path, Instagram and google plus, or you mark this page on bookmark section, We try to present you update periodically with all new and fresh images, like your surfing, and find the ideal for you.
Thanks for visiting our site, contentabove (plumber invoice template word
12 Reasons Why People Like Plumber Invoice Template Word) published . Today we are excited to declare that we have discovered an incrediblyinteresting contentto be pointed out, namely (plumber invoice template word
12 Reasons Why People Like Plumber Invoice Template Word) Many people attempting to find details about(plumber invoice template word
12 Reasons Why People Like Plumber Invoice Template Word) and certainly one of them is you, is not it?