- What is the difference between Abstract class & Interface? When to use Interface and when to use Abstract class?
- What is the scenario for multiple inheritances? Can you give an example?
- What are differences between IQueryable & IEnumerable?
- What are the difference between List & IEnumerable? Which is better?
- What is anonymous type? What is the difference between ‘var’ & ‘dynamic’?
- Can you explain about dependency injection?
- What are delegate and multi-cast delegate?
- What is anonymous method?
- What is the lambda expression and expression tree?
- What is Lazy loading in C#?
- What is generation mechanism in memory management?
- What is extension method?
- What is the difference between finally and finalize?
- What is a strong name in assembly? What is satellite assembly?
- What is delay signing? What are the type of signing in assembly & whats the difference?
- What are the types of inheritance? Describe all.
- What is the difference between a class & structure?
- What is a virtual class? Why we use virtual class?
- Suppose I need to use an DLL & I want to overwrite DLL method. What are the steps to achieve this?
- What is serialization? Why we use it? What are the types of serialization?
- What is a threading? What are its different types?
- What is "yield" keyword in C#?
March 6, 2014
C# Most FAQ in Interview
FAQs in ASP.NET MVC
- What is the benefit of Razor w.r.t. ASPX view engine?
- What are Action Link and Action Result in MVC? Can you list out the different types of action results returned by action method?
- What are areas in MVC?
- Does MVC support view state? If not, how can we can manage the same?
- What are Html helpers?
- How to create custom data annotation?
- What is filter in MVC? What are the types of filters in MVC?
- What is rout table in MVC?
- What is a view engine? Which is faster: Razor or ASPX?
- How MVC works to process a new request?
- What is the difference between MVC and MVVM?
- What are the difference between ASP.NET MVC and aspx web forms? When you will choose MVC architecture and when to choose ASPX web forms?
- What is data annotation? Can you define how can I define custom data annotation?
- What is view bag, view data and temp data?
- How you will pass parameters to controllers? What are different techniques to pass parameters from view to controllers?
- What is the difference between @Html.ActionLink and Url.ActionLink?
- What are different state management techniques in ASP.NET MVC?
- Does ASP.NET MVC support view state? Why?
- In ASP.NET MVC, what are the session modes and what is default session mode?
- What is Action Result and what are different types of Action Results available in ASP.NET MVC?
March 5, 2014
ServiceStack - An Introduction
What is a ServiceStack?
ServiceStack is an open source,
cross-platform for .Net and Mono REST web service framework and can run on both
.Net framework as well in Mono platform too. ServiceStack have the
flexibility of auto configuration of all standard output formats – XML, JSON,
CSV, JSV, SOAP1.1, SOAP1.2 and endpoints –REST, RPC, SOAP without any
configuration. It embraces only the concepts of DTO and not RPC concept.
Whereas, WCF has the option of both. Service developed in service stack can
run in windows environment using .Net framework or in Linux OS with Mono*
support.
*Mono supported OS are:
Linux, Mac OS X, iOS, Sun Solaris,
BSD, MS Windows, Nintendo Wii, Sony PlayStation 3 etc.
Why ServiceStack?
ServiceStack is not instead of WCF for its better performance, but main feature is that it can be deployed and works in cross platform like Windows, Mono, Linux, iOS, Mac OS etc.
ServiceStack versus WCF:
- WCF can be deployed only windows
platform whereas Service Stack supports cross OS environment deployment.
- WCF works on both DTO and RPC
concepts whereas Service Stack works uses DTO concept only.
- In WCF, if we do not define
attribute [DataContract] then it will ignore it. But Service Stack will serialize
it in plain text.
Hosting a Service Stack:
Service Stack can be hosted in any of the following:
- Stand-alone
mode
- With an
existing ASP.Net web application
- Windows
service
- Console application
For more detail, please read here.
Creating First Service Stack Web Service:
Download Service Stack libraries from visual studio package manager. To download run command:
Install-package ServiceStack
Steps to create a service stack:
Common name space:
using System.Web.UI;
using ServiceStack;
using ServiceStack.CacheAccess;
using ServiceStack.ServiceInterface;
using ServiceStack.WebHost.Endpoints;
using ServiceStack.CacheAccess;
using ServiceStack.ServiceInterface.ServiceModel;
using ServiceStack.OrmLite;
using ServiceStack.Common;
Step: 1 Create an empty web application and then install packages for service stack.
Step: 2 Add a class file ad define request and response class.
[Route("/HelloRequest")]
[Route("/HelloRequest/{Name}")]
public class HelloRequest
{
public string Name { get; set; }
}
public class HelloResponce
{
public string Result { get; set; }
}
public class HelloService : IService
{
public object Any(EmployeeRequest reqObj)
{
return new HelloResponce { Result = "You have entered: " + reqObj.Name };
}
public object Get(EmployeeRequest reqObj)
{
Return your_definedtype;
}
}
Step: 3 Add a class for AppHost.
public class HelloAppHost : AppHostBase
{
public HelloAppHost() : base("Here is your service:", typeof(HelloService).Assembly)
{
}
public override void Configure(Funq.Container container)
{
// Defined this route in class attribute
Routes.Add("/HelloRequest")
.Add("/HelloRequest/{Name}");
}
}
Step: 4 Add a Global.asax file and add the following code line to initialize the service request.
protected void Application_Start(object sender, EventArgs e)
{
new HelloAppHost().Init();
}
Step: 5 Add the following lines in Web.config file.
Step: 6 Build the service and run it. On browse you can see the following result, if everything is correct.
Creating First Service Stack Web Service:
Download Service Stack libraries from visual studio package manager. To download run command:
Install-package ServiceStack
Steps to create a service stack:
Common name space:
using System.Web.UI;
using ServiceStack;
using ServiceStack.CacheAccess;
using ServiceStack.ServiceInterface;
using ServiceStack.WebHost.Endpoints;
using ServiceStack.CacheAccess;
using ServiceStack.ServiceInterface.ServiceModel;
using ServiceStack.OrmLite;
using ServiceStack.Common;
Step: 1 Create an empty web application and then install packages for service stack.
Step: 2 Add a class file ad define request and response class.
[Route("/HelloRequest")]
[Route("/HelloRequest/{Name}")]
public class HelloRequest
{
public string Name { get; set; }
}
public class HelloResponce
{
public string Result { get; set; }
}
public class HelloService : IService
{
public object Any(EmployeeRequest reqObj)
{
return new HelloResponce { Result = "You have entered: " + reqObj.Name };
}
public object Get(EmployeeRequest reqObj)
{
Return your_definedtype;
}
}
Step: 3 Add a class for AppHost.
public class HelloAppHost : AppHostBase
{
public HelloAppHost() : base("Here is your service:", typeof(HelloService).Assembly)
{
}
public override void Configure(Funq.Container container)
{
// Defined this route in class attribute
Routes.Add
.Add
}
}
Step: 4 Add a Global.asax file and add the following code line to initialize the service request.
protected void Application_Start(object sender, EventArgs e)
{
new HelloAppHost().Init();
}
Step: 5 Add the following lines in Web.config file.
Step: 6 Build the service and run it. On browse you can see the following result, if everything is correct.
Step: 7 To test, type the URL as:
localhost:51391/hellorequest?name=navin&format=xml
This will display the result as you have passed in query string.
Subscribe to:
Posts (Atom)