Thursday, June 23, 2016

Channel 9 usefull tutorials






SQL Server DB:-





MVC:-






PowerShell:-







TFS and Git:-





Software Testing:-







JavaScript:-





Miscellaneous:-












Thursday, February 18, 2016

EF error - Type '{your_entity_name}' already defines a member called '.ctor' with the same parameter types


Couple of days ago I have decided to set custom database connection string to my entity framework data model in one of my project. Then I have created a partial class with the same name of my entity and modify connection string name of base parameter. like example below -


public partial class DBPointOfSalesEntities
{
  public DBPointOfSalesEntities()
           : base(my.GetEntityConnectionString)
      {
      }
}


and deleted default constructor from [model].cs file.

But the problem is, whenever I update my model, it generates default constructor with default base parameter value. And occurs error for ambiguous constructor name as I have created above.

Then after googling, I found a nice solution - there is a [model].tt file which is called T4 template. Entity model is generating its automatic code based on this template. There is a specific code snippet which is responsible for generating default constructor after updating model from database each time. following is that code snippet. I have just deleted those lines and my problem fixed.
public <#=code.Escape(container)#>()
      : base("name=<#=container.Name#>")
  {
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
      this.Configuration.LazyLoadingEnabled = false;
<#
}
foreach (var entitySet in container.BaseEntitySets.OfType())
{
  // Note: the DbSet members are defined below such that the getter and

  // setter always have the same accessibility as the DbSet definition
  if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
  {
#>
      <#=codeStringGenerator.DbSetInitializer(entitySet)#>
<#
  }
}
#>
   }



Happy coding...

Wednesday, January 13, 2016

Using "Crystal Report" with "Visual Studio 2010"


First shocking news is Crystal Report tool is not included by default with Visual Studio 2010. To come back from this shock, download crystal report tool from following link

=>
http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0.exe
After install don't forget to restart your computer. Because this is WINDOWS. Then after creating your first report if you get the following exception -
Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies.

Than open App.Config file. Then find the attribute useLegacyV2RuntimeActivationPolicy and change the value to "true"


Happy Coding..........

Dynamic query and Incorrect syntax near 'GO' error.


This is in
codeproject... :)

Fun! hah?