Created
February 15, 2018 06:14
-
-
Save Abhinay-g/93b149a92db2a95969f701719356b28f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
goto startup class | |
contain configure method | |
to see development or production enviroment we go to see enviromet variable | |
right click on project > properties > debug> | |
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
IHostingEnvironment env : env object will have parameter called EnviromentName== "Development" | |
============================================================== | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddMvc(); | |
} | |
hare in this method we add all the services to used in our applicaiton and controller | |
public void Configure(IApplicationBuilder app, IHostingEnvironment env) | |
{} | |
this method will set HTTP pipeline : means how applicaiton will respont to HTTP method | |
1 app.UseBrowserLink() : use to set browser link | |
2 app.UseDeveloperExceptionPage() : for errors pages | |
3 app.UseExceptionHandler("/Home/Error") : this cathes exception and shoe Error page | |
4 app.UseStaticFiles() prepare static files to served for App (js , xml, img. json blah blah) | |
5 app.UseMvc(routes =>) : to set MVC route | |
========================================================================== | |
Project Strucure : | |
wwwroot: all static files will be stored : JS , IMG, CSS,bootstrap | |
Componenet: kind of replacement to partial view , contianes view , it can we used without modfel binding , contain Invoke() method | |
TagHelper: it will store all our custome tag helper | |
Q: View model, how is differenet from model | |
Tag helper : very unknown | |
component : whrere to use | |
========================================================================== | |
why interfaces ?? for category and drink | |
why mocks: mocks are simple C# classes which will implement interface , them we will create a method and properties . | |
mocks are to provide data to controllers | |
==================================================== | |
now we will add services to our app | |
============================================== | |
working with EF: | |
Create a DBContext CS file in project root | |
add the respective table or model | |
Add Appsetting file in app root | |
Give a connection string name | |
Now go to start up CS | |
=================================== | |
thumb rule : | |
Add-migration Name | |
Update-database | |
for any changes in AppDBContext file | |
* we have to add Shopping cart functionality | |
Add model | |
add into AppDBcontext | |
=================================== | |
tag helper help to render Server side code to HTML | |
we can create a custome tag which can be used in CSHTML file | |
================================ | |
to work with identity we need to update AppDBContext, | |
we need to inherit IdentityDbContext<IdentityUser> instead of DbContext | |
Now make changes in Startup.cs service for Identity service provided my Entity framework | |
now make changes in Staratup.cs Configuration to make our application use Identity (app.UseIdentity()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment