Dot Net Stuff

CRUD Operations using ADO.Net and C# in ASP.Net

For ASP.Net beginner, it will slightly difficult to understanding of basic insert, update, delete & get operation. You can find several tutorials over internet, but they many of them have used entity framework’s code first or database first approach. But this article will follow a simple step that will allow us to understand & perform CRUD operations in ASP.Net using ADO.Net and C#. We will use normal ADO.Net syntax to perform all basic insert, update, delete & get operation in ASP.Net. We will not use any stored procedure for now as it will become more easy for beginners. Once you will able to understand these basic concepts, you can use stored procedure too.

Continue Reading>>

Visual Studio 2015 Preview Comes with Emulator for Android, MVC6 and Entity Framework 7

Microsoft had launched Visual Studio 2015 Preview. Let try to know what's new in this release and point you more details. One of the other large announcements today is that we will open source the full server-side .NET core stack from ASP.NET 5 to the CLR and BCL and this version will run on Linux and MacOS X as well as Windows.

Since the majority of initial comments tend to be questions about supported configurations, I’ll put this up front: before you try to upgrade from Visual Studio "14" CTPs to Visual Studio 2015 Ultimate Preview, first uninstall Visual Studio "14" CTP – if you don’t, your system can wind up in an unstable state.

Continue Reading>>

Understanding Simple Factory Design Pattern implementation with real world example

Simple Factory Design Pattern doesn’t belong to the Gangs of Four. A Simple Factory Pattern is one of that returns an instance of one of several possible classes, depending on the data provided to it. This implies that the classes it returns have same parent class and methods, but each of them perform task differently for different kind of data. Continue Reading>>

Exploring .Net Design Patterns in Software development

Design patterns were introduced by GOF(Gangs Of Four) Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides’s seminal work Design Patterns: Elements of Reusable Object-Oriented Software (Addison-Wesley).

Design patterns provide a high-level language of discourse for programmers to describe their systems and to discuss solutions to common problems. This language comprises the names of recognizable patterns and their elements. Each design pattern shave its own templates and these patterns have illustrative names and are described with diagrams illustrating, their role players. There are 23 design patterns. These patterns are divided into three groups: structural, creational, and behavioral.

Continue Reading>>

Understanding Model Binding in ASP.NET MVC with Example

A view can display a form that has fields such as text boxes, check boxes, radio buttons, and so forth, and a submit button. When the user submits the form, the information in the fields is sent to the controller.ASP.NET uses an HttpRequest object to handle requests. Information coming in the request is stored in different collection objects depending on how the request was sent and the type of information. For example, if the request was sent via HTTP GET, such as http://www.DotNet-Tutorial.com/page?id=1&v=true, then the values for the parameters id and v are stored in the HttpRequest.QueryString collection. If the request is sent using HTTP POST, then the values are stored in the HttpRequest.Form collection. Uploaded files are stored in the HttpRequest.Files collection. If the request is based on a route, then the values are stored in the RouteData.Values dictionary.

Continue Reading>>

Understanding Generic Anonymous Methods and Lambda Expressions in C#

Anonymous methods behave like regular methods except that they are unnamed. Anonymous Methods were introduced as an alternative to defining delegates that did very simple tasks, where full-blown methods amounted to more than just extra typing. Anonymous methods also evolved further into Lambda Expressions, which are even shorter methods.

Continue Reading>>

Understanding and Programming with Anonymous Types in C#

Anonymous types use the keyword var. Var is also used in Pascal and Delphi today, but var in Delphi is like ByRef in Visual Basic (VB) or ref in C#. The var introduced with .NET 3.5 indicates an anonymous type. Now, our VB friends are going to think, “Well, we have had variants for years in VB.” But var is not a dumbing down and clogging up of C#. Anonymous types are something new and necessary.

The simple meaning of Anonymous is that you don’t specify the type. You write var and C# figures out what type is defined by the right side, and C# emits (writes the code), indicating the type. From that point on, the type is strongly defined, checked by the compiler (not at runtime), and exists as a complete type in your code. There is one point to remember, you didn’t write the type definition; C# did.

Continue Reading>>

Understanding Loose Coupling and Tight Coupling

As the name suggesting loose coupling means reducing dependencies of a class that use a different class directly. Loose coupling promotes greater reusability, easier maintainability. On the other hand tight coupling, classes and objects are dependent on one another. I must say that, tight coupling is usually bad because it reduces flexibility and re-usability of code and we are not able to achieve complete object originated programming features.

What is Tight Coupling:-

As par above definition a Tightly Coupled Object is an object that needs to know about other objects and are usually highly dependent on each other's interfaces. When we change one object in a tightly coupled application often it requires changes to a number of other objects. There is no problem in a small application we can easily identify the change. But in the case of a large applications these inter-dependencies are not always known by every consumer or other developers or there is many chance of future changes. Continue Reading>>