Latest posts tagged on "C#"



In this post, we will see the easiest way to create a package with all the symbols in Visual Studio 2017. So that once we install a symbol server and upload package to this symbol server then we can debug that package in Visual Studio 2017.  I will share steps to debug package in Visual Studio 2017 in "Setup and Debug NuGet packages in Visual Studio 2017". 

The process to Create a new package in Visual Studio 2017:

All process to create package will work as expected after these changes so you can use any of the processes to create new package i.e. msbuild, pack commands. Here I will explain default option to pack package with source and symbol. 


In the Previous post, we learned about Validation with Jquery. In the Current post, we will learn a new feature of C sharp in .net framework 4.5. 

Introduction to Async and Await

Async and await are two new keywords that are introduced with .net framework 4.5 for supporting asynchronous programming. We can use Async feature which makes asynchronous programming straightforward as synchronous programming.

Async modifier specifies that method is an async method and returns a Task or Task. Task or Task return type hold information regarding ongoing work of methods i.e. Task contains information that the caller of the method can use status of Task, its unique ID and method's result.

async Task<int> DoSomeTasksAsync()

Await operator is used with return task in an await expression. This expression suspends execution of the method that contains it until the awaited task is complete. In mean time controls is returned to the caller of the suspended method.

Task<int> taskobject=  DoSomeTasksAsync()
int taskResult = await taskobject;

Error while updating object with Entity framework

Posted by samunder on 8/15/2017 (IST) Category: Programming Tags:

Error Message: The property is part of the object's key information and cannot be modified

Introduction: Sometimes we get an error “The property is part of the object's key information and cannot be modified “ while trying to change the value of model class with entity framework whether you use MVC or ASP.NET. This issue comes when the property you are trying to update is in the list of object key collection of Entity model. To Resolve this we can follow below steps.


Error CS0117: NamespaceOuter does not contain a definition for NamespaceInner or The namespace in dll conflicts with the type in dll

In the last post regarding error will see how to resolve issue of Error Message: The property is part of the object's key information and cannot be modified

Sometimes we receive above error when trying to run our web site but does not show any error on the build and show build success. It is a strange situation when your solution builds successfully but show error when try to run the website and if you try to see namespace name in intelligence than we can see the name of the namespace.


Recently I got a task to upload heavy data to SQL server database. Data was in XML files and I am to upload that files in the database. Size of XML file was big. First I tried to fetch data and pull into my Data Base one by one. I faced performance issue due to continues inserting process. So decided to read XML file in the data table and upload this data table to SQL server database using SqlBulkCopy class. It was much better to copy data table to the database using bulk copy operation in c sharp.

The data table is being used to store SQL server data in memory for local use. So we can hold XML file data in Data table and bulk copy complete data of data table in the database with in seconds.



In this post will explain differences between Abstract classes and Interfaces

An Abstract class without any implementation just looks like an Interface; however, there are a lot of differences than similarities between an Abstract class and an Interface. Let's explain both concepts and compare their similarities and differences.

What is an Abstract Class?

An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

What is an Interface? 

An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines the specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn't support multiple inheritances, interfaces are used to implement multiple inheritances.


OOPS Concepts 

Class: It is a collection of objects.

Object: It is a real time entity.

An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object's behavior. For example, the hand can grip something or a Student(object) can give the name or address. In pure OOP terms, an object is an instance of a class 

Class is composed of three things name, attributes, and operations

public class student
{
}
student objstudent=new student (); 

According to the above sample, we can say that Student object, named objstudent, has created out of the student class.

In the real world, you will often find many individual objects all of the same kind. As an example, there may be thousands of other cars in existence, all of the same make and model. Each car has built from the same blueprint. In object-oriented terms, we say that the car is an instance of the class of objects known as the car. In the software world, though you may not have realized it, you have already used classes. For example, the Textbox control, you always used, is made out of the Textbox class, which defines its appearance and capabilities. Each time you drag a Textbox control, you are actually creating a new instance of the Textbox class.


Introduction

Here I will explain about uses of 3-Tier architecture and how to create or implement 3-tier architecture for our project in asp.net 

Description

1.    What is the use of 3-tier architecture and why we go for that architecture? 

2.    First we need to know what 3-Tier architecture is. 

3.    How to create 3-Tier architecture for our project?

Uses of 3-Tier Architecture

1.    To make application more understandable. 

2.    Easy to maintain, easy to modify application and we can maintain good look of architecture.

3.    If we use this 3-Tier application we can maintain our application in consistency manner.   

Basically 3-Tier architecture contains 3 layers

1.    Application Layer or Presentation Layer 

2.    Business Access Layer(BALor Business Logic Layer(BLL

3.    Data Access Layer(DAL)

Here I will explain each layer with simple example that is User Registration

Latest on posts

Blog Archive

Tags