구성에 제외하려는 테이블을 설정하는 방법이 있지만 필요한 것은 포함하려는 테이블의 이름을 설정하는 것입니다. 나머지는 제외합니다.SubSonic 3 IncludeTables 구성
이미이 작업을 수행 한 사람이 있습니까?
건배! 알렉스
구성에 제외하려는 테이블을 설정하는 방법이 있지만 필요한 것은 포함하려는 테이블의 이름을 설정하는 것입니다. 나머지는 제외합니다.SubSonic 3 IncludeTables 구성
이미이 작업을 수행 한 사람이 있습니까?
건배! 알렉스
좋아, 나는
그냥 는 TT 파일에 몇 군데에 다음 줄을 추가 ... 그것을 한 적이 : 경우 (ExcludeTables.Contains (tbl.Name)!) {if ((IncludeTables.Length! = 0 & &! IncludeTables.Contains (tbl.Name))) 계속;ActiveRecord.tt 아래의 관계에서 약간 다른 경우, 라인 (! ExcludeTables.Contains (fk.OtherTable)) { ((IncludeTables.Length! = 0 & &! IncludeTables.Contains 경우 (FK .OtherTable)))) continue;
및
는 상기 settings.ttinclude에 다음을 첨가 문자열 [] = IncludeTables 새로운 캐릭터 [] { "TABLEA", "TableB의"};구현하기는 쉽지만 이후의 음속 업데이트는 내 사용자 정의를 지울 것입니다. 이것을 프로젝트에 추가 할 수 있습니까?
감사합니다. Alex
설정을 변경하기 만하면되는 "해킹"이 있습니다.
public interface ITableExcluder
{
bool Contains(string table);
bool ShouldExclude(string table);
bool ShouldInclude(string table);
}
/// <summary>
/// Custom class to exclude tables via a programmatic means.
/// </summary>
public class TableExcluder : ITableExcluder
{
public bool Contains(string tableName)
{
if (ShouldExclude(tableName))
return true;
return !ShouldInclude(tableName);
}
public bool ShouldExclude(string tableName)
{
switch (tableName)
{
case "sysdiagrams":
case "BuildVersion":
return true;
}
if (tableName.StartsWith("blog_"))
return true;
return false;
}
public bool ShouldInclude(string tableName)
{
return true;
}
}
//This replaces the string array
ITableExcluder ExcludeTables = new TableExcluder();
해킹의 비트,하지만 최소한 다른 파일의 교체 부품을 방지 : 단지로 ... 문자열 [] ExcludeTables 교체!
멋집니다. 나는 그것을 시도 할 것이다! 사실 내 구현은 모든 파일에서 SubSonic 업데이트에 문제가되는 코드를 변경해야합니다. – AlexCode