일종의 까다로운 일입니다.
먼저이 문서를 읽으십시오. 아직 읽지 않은 경우 Model first.
그런 다음 사용자 정의 IGenerateActivityOutput
구현으로 별도의 클래스 라이브러리 프로젝트를 만듭니다.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Data.Entity.Design.DatabaseGeneration.OutputGenerators;
using System.Activities;
namespace MyCSDLToSSDL
{
public class MyCsdlToSsdl: IGenerateActivityOutput
{
private CsdlToSsdl _generator;
public MyCsdlToSsdl()
{
_generator = new CsdlToSsdl();
}
public T GenerateActivityOutput<T>(OutputGeneratorActivity owningActivity, NativeActivityContext context, IDictionary<string, object> inputs) where T : class
{
var str = _generator.GenerateActivityOutput<T>(owningActivity, context, inputs) as string;
return str.Replace("Type=\"datetime\"", "Type=\"smalldatetime\"") as T;
}
}
}
다음 단계는 데이터베이스 생성 워크 플로를 수정하는 것입니다.
- 파일 시스템에서 TablePerTypeStrategy.xaml을 찾으십시오.
- 이 파일을 다른 이름으로 같은 폴더에 복사하십시오. 예를 들어 TablePerTypeStrategy_smalldatetime.xaml. VS로 열기.
- 변경
OutputGeneratorType
은 CsdlToSsdlAndMslActivity
에서 "MyCSDLToSSDL.MyCsdlToSsdl, MyCSDLToSSDL"
입니다. 큰 따옴표가 필요합니다.
- 데이터베이스 생성 워크 플로 속성을 "TablePerTypeStrategy_smalldatetime.xaml (VS)"로 변경합니다.
- 모델에서 데이터베이스를 생성하십시오.
해결 방법과 매우 비슷하지만 작동합니다. :) 희망이 도움이!
대단한 답변을 보내 주셔서 감사합니다. 두 가지 방법으로 더 많은 것을 배울 수 있습니다. 현상금 잘받을 가치가 :) –
사실 하나의 문제가 있습니다 - 내 .NET 참조에 Microsoft.Data.Entity.Design.DatabaseGeneration.OutputGenerators가 누락 된 것 같습니다. 나는 Entity Power-Pack을 가지고있다. 내가 필요로하는 것이 더 있을까요? –
VS2010 설치 폴더에 있음 [설치 폴더] \ Microsoft Visual Studio 10.0 \ Common7 \ IDE –