EF 4.5 edmx .tt ファイルに 2 つの using ディレクティブを配置したいのですが、問題が発生しています。4.0 の構文は異なり、操作が簡単でした。
任意の助けをいただければ幸いです.... EF 4.0の構文:
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;
4.5 構文
public string UsingDirectives(bool inHeader, bool includeCollections = true)
    {
        return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
            ? string.Format(
                CultureInfo.InvariantCulture,
                "{0}using System;{1}" +
                "{2}",
                inHeader ? Environment.NewLine : "",
                includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
                inHeader ? "" : Environment.NewLine)
            : "";
    }
.tt ファイルに次の属性を追加する必要があります。
EF 4.0 構文
[Serializable]
[DataContract(IsReference = true)]
<#=Accessibility.ForType(entity)#> <#=code.SpaceAfter(code.AbstractOption(entity))#>partial class <#=code.Escape(entity)#><#=code.StringBefore(" : ", code.Escape(entity.BaseType))#>
{
<#
4.5 構文
public string EntityClassOpening(EntityType entity)
    {
        return string.Format(
            CultureInfo.InvariantCulture,
            "{0} {1}partial class {2}{3}",
            Accessibility.ForType(entity),
            _code.SpaceAfter(_code.AbstractOption(entity)),
            _code.Escape(entity),
            _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
    }
4.0 構文
void WriteProperty(string accessibility, string type, string name, string getterAccessibility, string setterAccessibility)
{
#> [DataMember]
    <#=accessibility#> <#=type#> <#=name#> { <#=getterAccessibility#>get; <#=setterAccessibility#>set; }
<#+
}
4.5 構文 類似の構文が見つかりません**
基本的に、edmx ファイルから再生成されたときのクラスの出力を次のようにしたいと考えています。
using System;
using System.Collections.Generic;
using System.Runtime.Serialization; using System.ServiceModel; 
namespace YeagerTechModel
{
   [Serializable] 
   [DataContract(IsReference = true)]    
   public partial class Priority 
    {
        public Priority()
        {
            this.Projects = new HashSet<Project>();
        }
     [DataMember]         
     public short PriorityID { get; set; }
    [DataMember]         
     public string Description { get; set; }
     [DataMember]         
     public virtual ICollection<Project> Projects { get; set; }
    }
}