Showing posts with label Tutorials. Show all posts
Showing posts with label Tutorials. Show all posts

WebApi Tutorials

 

                                                         REST WebAPI

API:- API means a software code that helps two different software’s to communicate and exchange data with each other.

WebAPI:- Web API as the name suggests, is an API over the web which can be accessed using HTTP protocol.It is a concept and not a technology.

Asp.NET WebAPI:- ASP.NET Web API is a framework for building HTTP services that can be accessed from any client including browsers and mobile devices.It is an ideal platform for building RESTful applications on the.NET Framework.

The term API stands for ‘Application Programming Interface’. ASP.NET Web API is a framework for building Web API’s, i.e. HTTP based services on top of the .NET Framework. The most common use case for using Web API is for building RESTful services. These services can then be consumed by a broad range of clients like

1. Browsers

2. Mobile applications

3. Desktop applications

4. IOTs

What are IOTs

The term IOTs stands for Internet Of Things. Internet Of Things are the objects or devices that have an IP address and can communicate over the internet with other internet enabled devices and objects. Examples for IoT include security systems, electronic appliances, thermostats, cars etc..., in addition to desktops, laptops, and smart phones.

One important thing to keep in mind is that, though ASP.NET Web API framework is widely used to create RESTful services, it can also be used to create services that are not RESTful. In short, ASP.NET Web API framework does not dictate any specific architeture style for creating services. In this video, we will discuss creating RESTful services from scratch using ASP.NET Web API framework.

 

Restful WebAPI :- A REST API (also known as RESTful API) is an application programming interface (API or web API) that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services. REST stands for representational state transfer and was created by computer scientist Roy Fielding.


HttpRequest:-

C    ->  Create       ->        POST          ->  StatusCode   ->   return 201 (CREATED)

R    ->  Read         ->        GET             ->  StatusCode   ->   return 200 (OK)

U    ->  Update     ->        PUT             ->  StatusCode   ->   return 200 (OK)

D    ->  Delete      ->        DELETE       ->  StatusCode   ->   return 204 (NO CONTENT)

StatusCode   ->   return 400 (BadRequest)

StatusCode   ->   return 401 (Unauthorized)

StatusCode   ->   return 404 (NotFound)

StatusCode   ->   return 500 (InternalServerError)

StatusCode   ->   return 501 (NotImplemented)

StatusCode   ->   return 503 (ServiceUnavalialble)

 

MVC Tutorials

 

                                            MVC

Topics:

  1. MVC
  2. Routing
  3. Layout
  4. Partial View
  5. Bundling And Minification
  6. Data Transportation In MVC
  7. Helper Class
  8. Action Method
  9. Data Annotation
  10. Filters

  

 

1.MVC:- MVC is a software architecture pattern. Using MVC pattern we can generate multiple view of same data. It separates the application into three parts Model,View and Controller. 

Model:- Model represents data of the application. Model objects retrieve and store model state in a database.

View:- View is a user interface. View display data using model to the user and also enables them to modify the data.

Controller:- Controller handles the user request. The controller renders the appropriate view with the model data as a response.

 

Note:- We can't use Controller Name same as Application Name. This show error this(Ex-Employee) is a namespace but used as a type.

Namespace:System.Web.Mvc;

 

Entity Framework Tutorials

 

bFirst vs CodeFirst Approach:-

·         DatabaseFirst approach can be used only with existing database  while CodeFirst approach can be used with existing database and a non existing or empty database.

·         CodeFirst used Migration tool for updates the database schema while DbFirst not used Migration.

 

Step To Add Existing Database In CodeFirst

·         FirstStep:-       Select CodeFirstFromDatabase from Entity DataModel Wizard

·         SecondStep:-   Run Enable-Migrations Command

·         Third Step:-     Run Add-Migration InitialModel -IgnoreChanges

·         Fourth Step:-   Run Update-Database

·         Now everytihing will same as CodeFirstWithNewDatabase   

 

 

SQl-Server Tutorials



1.DBMS Keys 1.Primary 2.Foreign 3.Unique 4.Composit 5.Candidate 6.Alternate  7.Super

2.Constrants 1.Not Null 2.Unique 3.Primary Key 4.Foreign Key.5.Check 6.Default  

3.Indexes 1.Clustered 2.Non-Clustered .3.Unique 4.Full-text 5.Xml. 6.Spatial

4.Operators 1.Arithmatic 2.Bitwise 3.Comparison 4.Logical 5.Compund

5.Function    1.System Define  1)String   2)Numeric 3)Date 4)Aggregate 5)Advance

                      2.User Defined   1)Scaler Value 2)Table Value

6.Procedure  1.Procedure without parameter  2.Procedure with Input Parameter

3.Procedure with output Parameter  4. Procedure with Optional Parameter         

5. Procedure with Return Value

7.Trigger And Magic Table    1)For Trigger   2)Instead Of Trigger

8.Join   1.Inner Join/Join  2.Outer Join 1.Left Join/Left Outer Join  3.Right Join/Righ Outer                        Join  4.Full Join/Full Outer Join    3.Cross Join

9.Union And Union All

10.View    1.System Defined View a)Information Schema  b)Catalog View

                   2.User Defined View    a)Single Table View b)Two Table View

11.Common Table Expression(CTE)

12.Temporary Table    1.Local Temp Table      2.Global Tamp Table

13.Sql Variable 


Keys:- Keys in Database Management System(DBMS) is an attribute or set of attributes which helps you to identify a row(tuple) in a relation(table). They allow you to find the relation between two tables. Keys help you uniquely identify a row in a table by a combination of one or more columns in that table.

Database Keys are used to establish and identify relationships between tables and within a table.

Different Types of Keys available in SQL-Server. 

1.Primary Key:- Primary key is a field that is uniquely identify each record in a database table. Primary key cannot be null. A table can have only one primary key.

Note:- 

1.A key can be primary key and also foreign key at the same time like in One to One     Relationship.

 2.A table can have more than one primary key in the form of Composite key.

  Ex:-In bridge table used for Many to Many Relationship.

2.Foreign Key:- A field that is a primary key in a database table called foreign key in another table. Foreign key can be  null or duplicate.

                                                                OR

A foreign key (FK) is a column or combination of columns that is used to establish and enforce a link between the data in two tables to control the data that can be stored in the foreign key table.

Note:- 

1.The table with the foreign key is called the child table, and the table with the primary key is called the referenced or parent table.

Ex:- Department and Employee are with one-to-many relationship. Department can have many Employee so Department is Parent Table and Employee will be child table. And DepartmentId will be Primary key in Department Table and Foreign key in Employee Table.

Other example are Customer and Order. A Customer can place many order at a time. So Customer will be primary table and Order will be child table. And Customer and Order make a one-to-many relationship.  

2 Foreign key Column can be Identity Column but never do that because:-

First remember a Foreign key simply requires that the value in that field must exist first in a different table (the parent table). That is all an FK is by definition. Null by definition is not a value. Null means that we do not yet know what the value is.

3.Unique Key:- Unique key is a set of one or more than one field in a database table that is used to prevent duplicate record in a field. A unique key can accept only one null value.

4.Candidate Key:- Those keys that fulfill the requirement of primary key is called candidate key. Every table must have at least one primary key but at the same time can have several candidate key.

5.Alternate or Secondary Key :- All keys accepts primary key are Alternate keys. Alternate keys are candidate keys that is not selected as primary key.

Note:- In a database table for retrieve data we need a key and select some rows as key with some condition and these keys are called candidate key.  Candidate key is a single key or a group of multiple keys that uniquely identify rows in a table then select primary key after that secondary key or alternate key which is left from making primary key.

6.Composite Key:- A key that is composed of more than one column. When primary key consists of multiple fields then it theoretically called Composite Key.

7.Super Key:- Subset of Primary key, Unique key, Alternate key. Super Key can contain multiple attributes that might not be able to independently identify tuples in a table, but when grouped with certain keys, they can identify tuples uniquely.

 

Opps Tutorials

                 Opps Concepts                            

 

·         Class

·         Class Types

1.      Static Class

2.      Abstract Class

3.      Sealed Class

4.      Partial Class

5.      Concrete Class/Non Abstract Class

6.      Singleton Class/Non-Static

·         Classs Reference Variable

·         Fields And Properties

·         Methods

·         Method Types

7.      Static Method

8.      Abstract Method

9.      Virtual Method/Pure Virtual Method

10.  Partial Method

11.  Annonymous Method

12.  Extention Method

13.  Concrete Method/Non Static Method

14.  Sealed Method

·         Method Parameters

15.  ValueType

16.  RefType

17.  ParamsArray

·         Local Variable

·         Object

·         Object Intializer

·         Constructor

·         Constructor overloading

·         Constructor Types

·         Default

·         Private

·         Copy

·         Parameterize

·         Static

·         Encapsulation

·         Access Modifier

·         Private

·         Public

·         Protected

·         Internal

·         Internal Protected

·         Inheritance

·         Single

·         Multilevel

·         Multiple Interface Inheritance

·         Hybrid

·         Hirarchical

·         Polymorphism

·         Function Overloading

·         Function Overriding

·         Function Hidding

·         Virtual And Override Keyword

·         Virtual Method

·         Abstraction

·         Abstract Class

·         Abstract Method

·         Abstract Keyword

·         Interface

·         Interface Implementation

·         Default Implementation

·         Explicit Implementation

·         Interface Types

·         Non Generic Interface

·         Generic Interface

 

OPPs:- Object-Oriented Programming System (OOPs) is a programming concept that works on the principles of abstraction, encapsulation, inheritance, and polymorphism.

Object-oriented programming is about creating objects that contain both data and methods.Classes and objects are the two main aspects of object-oriented programming.

For example:- Everything in C# is associated with classes and objects, along with its attributes and methods.  in real life, a car is an object. The car has attributes, such as weight and color, and methods, such as drive and brake.

A Class is like an object constructor, or a "blueprint" for creating objects.

When a variable is declared directly in a class, it is often referred to as a field (or attribute) and that you can access them by creating an object of the class, and by using the dot syntax (.).

    class Car

    {

        string color = "red";

        int maxSpeed = 200;

 

        static void Main(string[] args)

        {

            Car myObj = new Car();

            Console.WriteLine(myObj.color);

            Console.WriteLine(myObj.maxSpeed);

        }

    }

 

#Pillars of Object Oriented Programming

·         Encapsulation

·         Inheritance

·         Polypmorphism

·        Abstraction