Skip to main content

Posts

Showing posts from 2015

Versioning ASP.NET Web API Services uri based Versioning

I’ve been doing some work with APIs lately and finally had the chance to dig into the  ASP.NET Web API  a bit more. While it’s technically brand new (released with .NET 4.5 and Visual Studio 2012), the Web API has been around in beta form for quite a bit now. For those of us who have done a fair amount of work with the WCF framework, the Web API is a welcome addition/replacement. Instead of monstrous configuration files and contract-first demands placed on us by WCF, we can now build RESTful web services using a very lightweight and HTTP-focused framework. As I work on designing a new API, one thing that I’m focused on right now is versioning.   In this blog post, I’ll show you how to build uri based versioning for ASP.NET Web API services. Reference  https://seroter.wordpress.com/2012/09/25/versioning-asp-net-web-api-services-using-http-headers/ http://www.codeproject.com/Articles/741326/Introduction-to-Web-API-Versioning http://bitoftech.net/2013/12/16/asp-net-web-api-versi

Compare database schema sql server free tools

Compare database schema sql server free tools SQL Admin Studio https://www.simego.com/Install/SQL-Tools Open DBDiff 0.9 http://opendbiff.codeplex.com/releases/view/72756 Related Urls : What is best tool to compare two SQL Server databases (schema and data) http://stackoverflow.com/questions/193438/what-is-a-free-tool-to-compare-two-sql-server-databases http://stackoverflow.com/questions/685053/what-is-best-tool-to-compare-two-sql-server-databases-schema-and-data

AngularJS Interview Questions and Answers

1) What is Angular.js ? AngularJS is a javascript framework used for creating single web page applications.  It allows you to use HTML as your template language and enables you to extend HTML’s syntax to express your application’s components clearly 2) Explain what are the key features of Angular.js ? The key features of angular.js are Scope Controller Model View Services Data Binding Directives Filters Testable 3) Explain what is scope in Angular.js ? Scope refers to the application model, it acts like glue between application controller and the view.  Scopes are arranged in hierarchical structure and impersonate the DOM ( Document Object Model) structure of the application.  It can watch expressions and propagate events. 4) Explain what is services in Angular.js ? In angular.js services are the singleton objects or functions that are used for carrying out specific tasks.  It holds some business logic and these function can be called as controllers, directive, f

How to send mail asynchronously in asp.net with MailMessage

With Microsoft.NET Framework 2.0 everything is asynchronous and we can send mail also asynchronously. This features is very useful when you send lots of bulk mails like offers , Discounts , Greetings . You don’t have to wait for response from mail server and you can do other task . By using     SmtpClient . SendAsync Method (MailMessage, Object)    you need to do  System.Net.Mail has also added asynchronous support for sending email. To send asynchronously, you need need to Wire up a SendCompleted event Create the SendCompleted event Call SmtpClient.SendAsync smtpClient.send() will initiate the sending on the main/ui  thread and would block.  smtpClient.SendAsync() will pick a thread from the .NET Thread Pool and execute the method on that thread. So your main UI will not hang or block . Let's create a simple example to send mail. For sending mail asynchronously you need to create a event handler that will notify that mail successfully sent or some errors occu

WEB API: PASSING A COMPLEX TYPE IN JSON USING J QUERY

In my  project i wanted to pass a complex type to the Post method of an Web Api controller. The Post itself will be done using JQuery in the JSON format. I noticed that the parameter was always null. After a bit of searching i found the solution Server Side code   public class ValuesController : ApiController     {         public class MyComplexType         {             public string Name { get; set; }             public MyComplexSubType MyComplexSubType { get; set; }         }         public class MyComplexSubType         {             public int Age { get; set; }         }         // GET api/<controller>         public IEnumerable<string> Get()         {             return new string[] { "value1", "value2" };         }         // GET api/<controller>/5         public string Get(int id)         {             return "value";         }               // POST api/values         p