Hi Erik,
I'm curious as to when people would use SQL Compact 3.5 as opposed to 4?
Thanks,
Arthur
I'm curious as to when people would use SQL Compact 3.5 as opposed to 4?
Thanks,
Arthur
Expression of type 'System.Data.Entity.Core.Metadata.Edm.EdmItemCollection' cannot be used for return type 'System.Data.Entity.Core.Metadata.Edm.EdmItemCollection'There's possibly something in my EDMX that's causing that but I can't seem to work out what. Anyone seen anything like this before? From a console command line I can 'get' to the SQL (... as IObjectContextAdapter).ObjectContext.CreateDatabaseScript()) so I think it must be designer related.
class TPContext : DbContext
{
public TPContext() : base() { }
public DbSet<T1> T1 { get; set; }
public DbSet<T2> T2 { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new T1Config());
modelBuilder.Configurations.Add(new T2Config());
base.OnModelCreating(modelBuilder);
}
}
By default, the connection string in App.config file should have the same name as context. Here's App.config:<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<connectionStrings>
<add name="TPContext" provider="System.Data.SqlClient" connectionString="Server=Domain\SQL2014;Database=Test;Trusted_Connection=true" />
</connectionStrings>
</configuration>
However, the error is thrown:public TPContext() : base("name=TPContext") { }
But same error is thrown. The only cure I've found is to pass connection string itself to constructor:public TPContext() : base(@"Server=Domain\SQL2014;Database=Test;Trusted_Connection=true;") { }
This works perfectly. Also I want to point out that the same error is thrown in EF5.