quote
The combination of the word “SORRY” and POLITENESS creates an amazing potion which can dissolve lots of anger in milliseconds. - Cassian Menol Razeek

How Fibonacci Sequence Relates to Nature
2009-01-05 Italian mathematician Leonardo Pisano had a problem worked on to find a mathematical pattern to answer the question: how many pairs of rabbits can be produced from a single pair of rabbits in one year? He carried out his work on following ...


Growth of personality is often mistaken as loss of humanity. - Cassian Menol Razeek

How to Suggest Values or Autocomplete Values When A User Types Into a Combo Box
08-06-2012 .Net has a 5 seconds super easy way to achieve this. Use ComboBox.AutoCompleteSource and ComboBox.AutoCompleteMode properties: (Available from .Net 2.0 onwards) Steps: Load all possible values to ComboBox.Items collection - this is th...

Using DispatcherTimer To Create A Timer In WPF
09-03-2012 // // WPF doesn't have a straightforward Timer control that you can drag and drop from the Toolbox. However, ther's still a straightforward easy way to implement this. You can use the provided System.Windows.Threading.DispatcherTimer ...

Posted in General | Comments Off on

Using multiple versions of Entity Framework in the same solution

2016/07/20

Using multiple versions of Entity framework by different projects within the same solution.

I had to develop a pilot project to use Entity framework (EF) 6.0 inside the solution that already has other projects that refers to EF 4.4.

While debugging I received this error:

Could not load file or assembly ‘EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

entity framework error b77a5c561934e089

entity framework error b77a5c561934e089

 

 

 

 

 

 

This can be solved by adding following configuration to the web.config file.



<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.4.0.0" newVersion="4.4.0.0" />
        <codeBase version="4.4.0.0" href="bin\ef44\EntityFramework.dll"/>
     </dependentAssembly>
     <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="4.4.0.0-6.0.0.0" newVersion="6.0.0.0" />
     </dependentAssembly>
      
   </assemblyBinding>
</runtime>

The Dependent Assembly entries inform the Run Time to use version for 4.4.0.0 for any project that require a version between 0.0.0.0 to 4.4.0.0 and use the version 6.0.0.0 for any project that require EF between 4.4.0.0 to 6.0.0.0.

The code base entry under the first dependent assembly advises the run time to locate  the  4.4.0.0 version of entity framework (EntityFramework.dll) under bin\ef44 folder.

The other version of EntityFramework.dll will be located in the usual bin folder.

Note: this article explains how you can find the publicKeyToken for any dll file or assembly.

References:

Posted in C#.Net | Tagged , , , , | Leave a comment

SQL Server data types explained with .net data types

2016/07/19

Source / Reference : Msdn

Member name Description
BigInt

Int64. A 64-bit signed integer.

Binary

Array of type Byte. A fixed-length stream of binary data ranging between 1 and 8,000 bytes.

Bit

Boolean. An unsigned numeric value that can be 0, 1, or null.

Char

String. A fixed-length stream of non-Unicode characters ranging between 1 and 8,000 characters.

Date

Date data ranging in value from January 1,1 AD through December 31, 9999 AD.

DateTime

DateTime. Date and time data ranging in value from January 1, 1753 to December 31, 9999 to an accuracy of 3.33 milliseconds.

DateTime2

Date and time data. Date value range is from January 1,1 AD through December 31, 9999 AD. Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds.

DateTimeOffset

Date and time data with time zone awareness. Date value range is from January 1,1 AD through December 31, 9999 AD. Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds. Time zone value range is -14:00 through +14:00.

Decimal

Decimal. A fixed precision and scale numeric value between -10 38 -1 and 10 38 -1.

Float

Double. A floating point number within the range of -1.79E +308 through 1.79E +308.

Image

Array of type Byte. A variable-length stream of binary data ranging from 0 to 2 31 -1 (or 2,147,483,647) bytes.

Int

Int32. A 32-bit signed integer.

Money

Decimal. A currency value ranging from -2 63 (or -9,223,372,036,854,775,808) to 2 63 -1 (or +9,223,372,036,854,775,807) with an accuracy to a ten-thousandth of a currency unit.

NChar

String. A fixed-length stream of Unicode characters ranging between 1 and 4,000 characters.

NText

String. A variable-length stream of Unicode data with a maximum length of 2 30 – 1 (or 1,073,741,823) characters.

NVarChar

String. A variable-length stream of Unicode characters ranging between 1 and 4,000 characters. Implicit conversion fails if the string is greater than 4,000 characters. Explicitly set the object when working with strings longer than 4,000 characters. Use NVarChar when the database column is nvarchar(max).

Real

Single. A floating point number within the range of -3.40E +38 through 3.40E +38.

SmallDateTime

DateTime. Date and time data ranging in value from January 1, 1900 to June 6, 2079 to an accuracy of one minute.

SmallInt

Int16. A 16-bit signed integer.

SmallMoney

Decimal. A currency value ranging from -214,748.3648 to +214,748.3647 with an accuracy to a ten-thousandth of a currency unit.

Structured

A special data type for specifying structured data contained in table-valued parameters.

Text

String. A variable-length stream of non-Unicode data with a maximum length of 2 31 -1 (or 2,147,483,647) characters.

Time

Time data based on a 24-hour clock. Time value range is 00:00:00 through 23:59:59.9999999 with an accuracy of 100 nanoseconds. Corresponds to a SQL Server time value.

Timestamp

Array of type Byte. Automatically generated binary numbers, which are guaranteed to be unique within a database. timestamp is used typically as a mechanism for version-stamping table rows. The storage size is 8 bytes.

TinyInt

Byte. An 8-bit unsigned integer.

Udt

A SQL Server user-defined type (UDT).

UniqueIdentifier

Guid. A globally unique identifier (or GUID).

VarBinary

Array of type Byte. A variable-length stream of binary data ranging between 1 and 8,000 bytes. Implicit conversion fails if the byte array is greater than 8,000 bytes. Explicitly set the object when working with byte arrays larger than 8,000 bytes.

VarChar

String. A variable-length stream of non-Unicode characters ranging between 1 and 8,000 characters. UseVarChar when the database column is varchar(max).

Variant

Object. A special data type that can contain numeric, string, binary, or date data as well as the SQL Server values Empty and Null, which is assumed if no other type is declared.

Xml

An XML value. Obtain the XML as a string using the GetValue method or Value property, or as an XmlReader by calling the CreateReader method.

Posted in C#.Net, SQL Server | Tagged , , , , | Leave a comment