Posts

Showing posts from 2017

Safe Navigation operator ?. in C sharp.

Its a very exciting feature in C sharp 6.0 . It makes our work very simple and easier . Lets take an example here . Suppose I want to access a grand child value like this Var value  =  Parent.Child.Child.Child ; So in this above query there is chance of getting the Null value from any of the object like Parent or Child one. If possibly Parent or Child value will be Null in run time it will  through the NullReferenceException . This above object accessing logic can be handled it in other way like conditional statement or Ternary operator as well . But Instead of applying this how we can handle it by Safe Navigation operator ?. This operator can be written as Var value  =  Parent ?.Child ?. Child ?. Child ; The Safe Navigation operator will check if the object to the left is not null , then fetch what  is to the right else return null and halt the access chain. This is how the safe Navigation operator works in c sharp. Enjoy .... Keep cod...

C# 6 new features: Auto assigning property.

                              C# 6 new features : Auto assigning property.  We have lots of new features and keyword added  in C# 6 but among those new property auto assigning property is one of them . So here we will discuss on this particular features only.                                    You can get this features in visual studio 2015 or higher version of Visual studio .Auto assigning property means we can set the values of property while we will declare the property. Before C# 6.0 we assigning the values to the property usually by declaring a constructor. So to improve the coding productivity the Microsoft Team added this new features in C# 6.0 .But one thing I just want to tell you that in both the cases we will get the same values but the way of initializing will be different. So lets take an exam...

WCF service :The maximum array length quota (16384) has been exceeded.

Image
I was working in my project and in my project WCF service was used. While running the application I got an error message like " The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 120363.'.  Please see InnerException for more details. " This was my service binding configuration  <bindings> <basicHttpBinding> <binding name= "BasicHttpBinding" closeTimeout= "00:01:00" openTimeout= "00:01:00" receiveTimeout= "01:00:00" sendTimeout= "01:00:00" allowCookies= "false" bypassProxyOnLocal= "false" hostNameComparisonMode= "StrongWildcard" maxBufferSize= "2147483647" maxBufferPoolSize= "2147483647" maxReceivedMessageSize= ...

What is TypeScript

Image
TypeScript  is a free and open source language which is developed and maintained by  Microsoft technologies . It was released on 2012 for first time. So initially when it was released it was only supporting for Visual studio framework(Visual studio version was 2013) that means only for windows OS. But later it was supported for all other OS like Linux , Mac etc. . Currently we have different editors like Eclipse , Webstrom, Emacs and Atom etc. where we can  create our TypeScript application.We can manages the TypeScript dependencies by two main ways             a. By npm (node.js Package ) . You can download the Node.Js  here  .             b. By TypeScript's Visual studio plugin. Here I am giving more emphasis on TypeScript application on Visual studio. So in Visual studio 2017 and Visual studio 2015 update 3 you will get the TypeScript by default. If you have not installed the TypeScript ...

Difference between @angular/core and angular 2/core

Basically these two reference we used when we import some classes like 'Component' and we used the classes in our typescript(.ts) file . Initially when angular 2 was in Beta version we were using the namespace angular2/core to import any class in our typescript file. But when angualar 2 was released in RC(Release Candidate) mode then we used @angular/core  to import any class in our typescript file. In Release  candidate mode Angular team repackaged all the packages and distributed @Angular npm scope. So one thing i just want to mention here that when you will used this "angular2/core", you should see a folder structure in your application root folder like   E:\Projects\Demo\node_modules\angular2\core But If you will import any class by this reference "@angular/core",then you should see the folder structure like this  E:\Projects\Demo\node_modules\@angular\core  Note:  This folder creation will done npm .When you will execute the command '...

Angular 2 application using Visual studio 2015

Image
              As we know between Angular 1.x.x and Angular 2.x.x has a huge difference . Although Angular 2 has an upgrade of Angular 1 but it has a lots of differences. Angular 2 is a complete rewrite of Angular 1.               So before creating any angular 2 application we need to first configure the environment.Angular 2 application is a dependent of lots of packages and we manage this packages by npm.               So we will divide the complete blog into two parts.In first part we will cover on set up/configure the system for angular 2 application and in the second part we will create our first angular 2 application using visual studio 2015. Part 1: These are the steps to set the environment to develop Angular 2 application: Step 1:  Required IDE - Visual Studio 2015(update 3).  Step 2:  Download and Install NodeJS from https://nodejs.org/en/download/ ...

The transaction is aborted or Failure while attempting to promote transaction.

This error is generally produced while you working on the  Linq query with Entity framework and there was some other system configurations like Visual studio 2015. Entity framework version 4. C# 4.5 But while I checked the Inner exception I got the following message  "There is already an open DataReader associated with this Command which must be closed first" So in my case there was some WCF services and from the WCF services I was extracting the data by Linq query . This was code  Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 using (TransactionScope scope = new TransactionScope()) { using (CentralisedData_DataDataContext db = new CentralisedData_DataDataContext()) { // Some code was there } db.SubmitChanges(); ...

Method 'System.String Format(System.String, System.Object, System.Object, System.Object)' has no supported translation to SQL

Method 'System.String Format(System.String, System.Object, System.Object, System.Object)' has no supported translation to SQL. Once I was working on the Linq query and found the above error message .  Actually i was inserting some data into the database by Linq query and  this was the code  foreach (var rep in (from rep in db.DO_TR                                                  join ab in db.DO_TA on rep.TeacherAbsenceID equals ab.Id                                                  join tt in db.Archive_TT on string.Format("{0}{1} ({2})", rep.RollClassCode,                                             ...