Вы находитесь на странице: 1из 7

1)explain mvc architecture

MVC stands for Model, View and Controller. MVC separates application into three components -
Model, View and Controller.

Model: Model represents shape of the data and business logic. It maintains the data of the
application. Model objects retrieve and store model state in a database.

Model is a data and business logic.

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

View is a User Interface.

Controller: Controller handles the user request. Typically, user interact with View, which in-turn
raises appropriate URL request, this request will be handled by a controller. The controller
renders the appropriate view with the model data as a response.

Controller is a request handler.

Points to Remember :

MVC stands for Model, View and Controller.

Model is responsible for maintaining application data and business logic.

View is a user interface of the application, which displays the data.

Controller handles user's requests and renders appropriate View with Model data.

2)Explain the architecture of your project


3)Ado.Net Code to get data from database

private DataTable dataTable;

string constring = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=|


DataDirectory|\IncomerDefault.mdf;Integrated Security=True;Connect Timeout=30";

string Query = "SELECT * FROM [Table] WHERE Default_Name = '" +


tableListBox.SelectedValue + "'";

SqlConnection con = new SqlConnection(constring);

SqlCommand cmd = new SqlCommand(Query, con);

try

con.Open();

SqlDataAdapter da = new SqlDataAdapter(cmd);

da.Fill(dataTable);

foreach(DataRow row in dataTable.Rows)

textBox1.Text = row[2].ToString();

comboBox1.Text = row[3].ToString();

comboBox3.Text = row[4].ToString();

textBox2.Text = row[6].ToString();

comboBox2.Text = row[7].ToString();

comboBox4.Text = row[8].ToString();

}
da.Dispose();

catch (Exception ex)

MessageBox.Show(ex.Message);

con.Close();

4)What is Entity Framework?

Entity Framework is an ORM from Microsoft that will enable the developers to work with
domain specific objects, which eliminates the extra code being written in the data access layer.

5)Difference b/w entity and ado,which is faster?

ADO.NET Entity Framework

ADO.NET is faster. "Entity Framework will be around the ADO.NET, which means ADO.NET is
faster than Entity Framework."

We need to write so much code to talk to database. Easy to use. As an Entity Framework will talk
to database without much code involved.

Performance is better than Entity Framework. Performance is not good compared to


ADO.NET.

6)Diffrence between Ienumarable and Iquerable

IEnumerable best suitable for in-memory operations because first it will execute “select
query” on server and it will load all the data into client memory then only it will apply all
the filter conditions.
Suppose if we have table called EmployeeDetails in our database from that we need to get
only top 3records where users gender equals to “Male” for this if we
use IEnumerable first it will execute “select query” on database server, it loads all the
records into memory and then it filters the data based on our requirement.
For remote operations IEnumerable is not suggestable and its better use IEnumerable to
perform query operations on in-memory collections like List, Array, etc.

In case if our tables contain more than 1 or 2 lac records then IEnumerable will fetch all
the records into our application memory then it will perform filter conditions due to this our
application becomes very slow.

IEnumerable is beneficial when you want to load all the data from query into memory and
apply further filtering. Its best suitable for LINQ to Objects and LINQ to XML operations.

IQueryable is best suitable for out-memory (remote database) operations because it will
execute select query with all filter conditions on server.

Suppose if we have table called EmployeeDetails in our database from that we need to get
only top 3 records where users gender equals to “Male” for this if we use IQueryable it
will execute “select query along with filter conditions” on database server and it loads
only required records based on our conditions.

Different ways to consume Webservice

In .Net without adding reference to the project we can call in the following ways

1. Using HttpWebRequest of System.Net namspace..,

2. We can also call webservice asynchronously using Scriptmanager

What is keep and peak

Once "TempData" is read in the current request it's not available in


the subsequent request. If we want "TempData" to be read and also
available in the subsequent request then after reading we need to
call "Keep" method as shown in the code below.

What is polymorphism?
Polymorphism provides following features:
 It allows you to invoke methods of derived class through base class
reference during runtime.

 It has the ability for classes to provide different implementations of


methods that are called through the same name.

Polymorphism is of two types:

1. Compile time polymorphism/Overloading

2. Runtime polymorphism/Overriding

Compile Time Polymorphism


Compile time polymorphism is method and operators overloading. It is also called early
binding.

In method overloading method performs the different task at the different input
parameters.

Runtime Time Polymorphism


Runtime time polymorphism is done using inheritance and virtual functions. Method
overriding is called runtime polymorphism. It is also called late binding.

When overriding a method, you change the behavior of the method for the derived
class. Overloading a method simply involves having another method with the same
prototype.

What is the signature keyword is used to override a method?

Virtual and override

What are the validation controls in asp?

 RequiredFieldValidator.
 RangeValidator.
 CompareValidator.
 RegularExpressionValidator.
 CustomValidator.
 ValidationSummary.

Dependency injection

it is a software design pattern which enables the development of


loosely coupled code. Through DI, you can decrease tight
coupling between software components. It is also known as
Inversion-of-Control, which makes unit testing convenient.

What are the web api filters

Web API includes filters to add extra logic before or after action method
executes. Filters can be used to provide cross-cutting features such as
logging, exception handling, performance measurement, authentication and
authorization.

Filters are actually attributes that can be applied on the Web API controller
or one or more action methods. Every filter attribute class must implement
IFilter interface included in System.Web.Http.Filters namespace. However,
System.Web.Http.Filters includes other interfaces and classes that can be
used to create filter for specific purpose.

The following table lists important interfaces and classes that can be used to
create Web API filters.

Filter Type Interface Class Description


Simple Filter IFilter - Defines the methods that are used in a filter
Action Filter IActionFilter ActionFilterAttribute Used to add extra logic before or after action methods
execute.
Authentication IAuthenticationFilter - Used to force users or clients to be authenticated before
Filter action methods execute.
Authorization IAuthorizationFilter AuthorizationFilterAttribute Used to restrict access to action methods to specific users
Filter or groups.
Exception Filter IExceptionFilter ExceptionFilterAttribute Used to handle all unhandled exception in Web API.
Override Filter IOverrideFilter - Used to customize the behaviour of other filter for
individual action method.

Вам также может понравиться