Null reference error

Jan 27, 2012 at 5:57 PM
Edited Jan 27, 2012 at 5:59 PM

I am getting a null error when I run this:

public const string ConnectionString = "name=SettingEntities

;
public const string ContainerName = "SettingEntities"; #region Constructors
public SettingEntities(string tablePrefix):base (ConnectionString, ContainerName,
    new BrandonHaynes.ModelAdapter.EntityFramework.ConnectionAdapter(
new
           
BrandonHaynes.ModelAdapter.EntityFramework.TablePrefixModelAdapter(tablePrefix),
            System.Reflection.
Assembly.GetExecutingAssembly()))
{
   
this.ContextOptions.LazyLoadingEnabled = true;
}

#endregion 

Here is my web.config

<connectionStrings>
    <
add name="SettingEntities" connectionString="metadata=res://*/Settings.csdl|res://*/Settings.ssdl|res://*/Settings.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=XXXXXX;initial catalog=CCCCCC;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /> </commectionStrings>

Any ideas? Thanks,
Will 

Feb 9, 2012 at 9:51 AM

I've got the same problem

Jun 26, 2012 at 9:12 AM

It's a possible error if you have tables without primary key.

I've fixed that by adding primary key manually (database first) even if Entity framework add automatically primary keys if does not exists.

Good luck,

Hope it help

Aug 13, 2012 at 7:41 AM

Another solution is to import the all project files instead of unique dll