Posts

Design Patterns of Microservices

  Design Patterns of Microservices Aggregator API Gateway Chained or Chain of Responsibility Asynchronous Messaging Database or Shared Data Event Sourcing Branch Command Query Responsibility Segregator (CQRS) Circuit Breaker Decomposition Please refer click the below link for the detailed explanation. Edureka - Microservice Design Pattern

Send Mail with Attachment using MVC

Image
Introduction: In this section,  I am going to explain how to send mail with attachment using MVC. Here I created  View to get data like receiver mail and attached file. By using SMTP server it will generate mail with attachment. Model: using   System ; using   System.Collections.Generic ; using   System.Linq ; using   System.Web ; namespace  WebApplication2 . Models {      public   class  MailDetailsMod      {          public   string  MailTo  {  get ;  set ;   }          public  HttpPostedFileBase MailAttachment  {  get ;  set ;   }              } } View: @model WebApplication2.Models. MailDetailsMod @{     ViewBag.Title = "Send Mail With Attachment using MVC" ; } < center >     < h2 > Send Mail with Attachment </ h2 >     @ using (Html.BeginForm( "SendMail" , "Mail" , FormMethod .Post, new { enctype = "multipart/form-data" }))     {         < tabl

Difference Between Web Services, WCF and WEB API

Web Service 1.       It is based on SOAP and returns data in XML form. 2.       It supports only HTTP protocol. 3.       It is not open source but can be consumed by any client that understands XML. 4.       It can be hosted only on IIS . WCF 1.       It is also based on SOAP and return data in XML form. 2.     It is the evolution of the web service(ASMX) and supports various protocols like TCP, HTTP, HTTPS, Named Pipes, MSMQ. 3.       The main issue with WCF is its tedious and extensive configuration. 4.       It is not open source but can be consumed by any client that understands XML. 5.       It can be hosted within the application or on IIS or using window service. WCF Rest 1.     To use WCF as WCF Rest Service  you have to enable webHttpBindings. 2.     It support HTTP GET and POST verbs by [WebGet] and [WebInvoke] attributes respectively. 3.     To enable other HTTP verbs you have to do some configuration in IIS to accept the  request of that

ASP.Net MVC: ViewData, ViewBag and TempData with examples

In this section, I will explain the purpose of ViewData, ViewBag, and TempData with examples. ViewData 1. ViewData is derived from the ViewDataDictionary class and is basically a Dictionary object i.e. Keys and Values where Keys are String while Values will be objects. 2. Data is stored as Object in ViewData. 3. While retrieving, the data it needs to be Type Cast to its original type as the data is stored as objects and it also requires NULL checks while retrieving. 4. ViewData is used for passing value from Controller to View. 5. ViewData is available only for Current Request. It will be destroyed on redirection. Syntax:- C# Code: public class Parent1Controller : Controller { public ActionResult Index() { ViewData[ "Message" ] = "Welcome to Dotnet Builders Tutorials" ; return View(); } } .CSHTML CODE: < html > < head >     < meta name ="viewport" co