EntityModelCodeGenerator.GenerateCode Method

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

Calls the CodeGen API to generate the code file from the CSDL file

Namespace:  Microsoft.Data.Entity.Design.VisualStudio.SingleFileGenerator
Assembly:  Microsoft.Data.Entity.Design (in Microsoft.Data.Entity.Design.dll)

Syntax

'Declaration
<SuppressMessageAttribute("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId := "Microsoft.VisualStudio.Shell.Interop.IVsErrorList.BringToFront")> _
<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")> _
<SuppressMessageAttribute("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")> _
<SuppressMessageAttribute("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")> _
Protected Overrides Function GenerateCode ( _
    inputFileName As String, _
    inputFileContent As String, _
    defaultNamespace As String _
) As Byte()
'Usage
Dim inputFileName As String 
Dim inputFileContent As String 
Dim defaultNamespace As String 
Dim returnValue As Byte()

returnValue = Me.GenerateCode(inputFileName, _
    inputFileContent, defaultNamespace)
[SuppressMessageAttribute("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsErrorList.BringToFront")]
[SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
[SuppressMessageAttribute("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
[SuppressMessageAttribute("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")]
protected override byte[] GenerateCode(
    string inputFileName,
    string inputFileContent,
    string defaultNamespace
)
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1806:DoNotIgnoreMethodResults", MessageId = L"Microsoft.VisualStudio.Shell.Interop.IVsErrorList.BringToFront")]
[SuppressMessageAttribute(L"Microsoft.Reliability", L"CA2000:Dispose objects before losing scope")]
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1031:DoNotCatchGeneralExceptionTypes")]
[SuppressMessageAttribute(L"Microsoft.Maintainability", L"CA1506:AvoidExcessiveClassCoupling")]
protected:
virtual array<unsigned char>^ GenerateCode(
    String^ inputFileName, 
    String^ inputFileContent, 
    String^ defaultNamespace
) override
[<SuppressMessageAttribute("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsErrorList.BringToFront")>]
[<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")>]
[<SuppressMessageAttribute("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")>]
[<SuppressMessageAttribute("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")>]
abstract GenerateCode : 
        inputFileName:string * 
        inputFileContent:string * 
        defaultNamespace:string -> byte[] 
[<SuppressMessageAttribute("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults", MessageId = "Microsoft.VisualStudio.Shell.Interop.IVsErrorList.BringToFront")>]
[<SuppressMessageAttribute("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")>]
[<SuppressMessageAttribute("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")>]
[<SuppressMessageAttribute("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")>]
override GenerateCode : 
        inputFileName:string * 
        inputFileContent:string * 
        defaultNamespace:string -> byte[] 
protected override function GenerateCode(
    inputFileName : String, 
    inputFileContent : String, 
    defaultNamespace : String
) : byte[]

Parameters

  • inputFileName
    Type: System.String
    The full path of the CSDL file; this is fed in from the ProjectItem
  • inputFileContent
    Type: System.String
    The contents of the CSDL file - this should always be used so that we can gen off of in memory documents

Return Value

Type: System.Byte[]
null implies error, else the contents of the file

See Also

Reference

EntityModelCodeGenerator Class

Microsoft.Data.Entity.Design.VisualStudio.SingleFileGenerator Namespace