데이터베이스 작업에 사용할 클래스 라이브러리 프로젝트로 내 DbSet
을 이동하려고합니다.간단한 멤버 자격 기능을 클래스 라이브러리 프로젝트로 이동
나는 Code First
/SimpleMembershipProfider
프로젝트에 this 자습서를 따라 왔습니다. 나는 이미 클래스 테이블 프로젝트를 통해 새로운 테이블 등으로 데이터베이스를 채웠다.
그러나 나는 this image에서 볼 수있는 webpages_ 테이블을 놓치고 있습니다.
이 내 데이터 컨텍스트 클래스 :
public class DataContext : DbContext
{
public DataContext() : base("DefaultConnection")
{
}
public DbSet<Orders> Orders { get; set; }
public DbSet<Appointment> Appointment { get; set; }
public DbSet<UserProfile> UserProfile { get; set; }
}
그리고 모든 DbSet
을 위해 내가 CS 파일을 만들었습니다. web.config
의 connectionString
을 복사하여 lib 프로젝트의 app.config
에 넣었습니다. 내 webproject의 필터 폴더 (클래스 InitializeSimpleMembershipAttribute
이있는)로 할 모르겠어요
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=.;Initial Catalog=aspnet-CodeFirst-test;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<roleManager enabled="true" defaultProvider="SimpleRoleProvider">
<providers>
<clear />
<add name="SimpleRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData" />
</providers>
</roleManager>
<membership defaultProvider="SimpleMembershipProvider">
<providers>
<clear />
<add name="SimpleMembershipProvider" type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData" />
</providers>
</membership>
</system.web>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
</configuration>
:이 같은 app.config
파일이 모습입니다.
webpages_
을 데이터베이스에 생성하는 방법을 누군가에게 알려 줄 수 있습니까? 그리고 websecurity 등을 클래스 lib 프로젝트로 옮기는 방법은 무엇입니까?
미리 감사드립니다.
'SimpleMembership'을 제어하고 프로젝트 엔티티 프레임 워크에 포함 시키려고합니까? – Komengem