我创建了一个可移植类库针对.NETPortable, v4.0
我不能使用.NET Portable的Code First流利API吗?
在下面的类
public class AddressConfiguration : EntityTypeConfiguration<Address>
{
public AddressConfiguration()
{
ToTable("Addresses");
HasKey(c => c.Id);
}
}
在行HasKey(c => c.Id);
视觉工作室抱怨
The type 'Expression<>' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
我失去的是什么?
的App.config
是
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
而packages.config
是
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="portable40-net45+sl5" />
</packages>
什么是错误? – Nikolaus
@尼古拉斯你是什么意思?我已将它包含在问题 – OrElse
您使用哪个版本的VS? – Nikolaus