Class EntityWriter
Used to write the entity class definition for an existing LemonEdge entity Interface (obtained either from custom .net code (must b marked with EntityDefinitionAttribute) or a ICustomObject)
Implements
Inherited Members
Namespace: LemonEdge.API.Core.Writers
Assembly: LemonEdge.API.dll
Syntax
public class EntityWriter : IEntityWriter
Constructors
EntityWriter()
Declaration
public EntityWriter()
Methods
AddAttributes(IEnumerable<CustomAttributeData>, Func<Type, bool>, string)
Declaration
public string AddAttributes(IEnumerable<CustomAttributeData> attributes, Func<Type, bool> shouldAddAttributeType, string tabPrefix)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<CustomAttributeData> | attributes | |
Func<Type, bool> | shouldAddAttributeType | |
string | tabPrefix |
Returns
Type | Description |
---|---|
string |
AddFileFooterAndCloseNamespaces(ClassFileWriter)
Closes the [LemonEdge.Entities] namespace started by AddFileHeadersAndNamespace(ClassFileWriter, string)
Declaration
public void AddFileFooterAndCloseNamespaces(ClassFileWriter writer)
Parameters
Type | Name | Description |
---|---|---|
ClassFileWriter | writer | The writer to close the namespace on |
AddFileHeaders(ClassFileWriter, string)
Adds the standard using statements required for the entity defintion code to work correctly in LemonEdge, and starts the namespace [LemonEdge.Entities]
Declaration
public void AddFileHeaders(ClassFileWriter writer, string customUsing)
Parameters
Type | Name | Description |
---|---|---|
ClassFileWriter | writer | The writer to add the using statements to |
string | customUsing | Optionally any custom using statements for the entity to reference specified types |
WriteFile(EntityDescriptor, string, string)
Writes a whole file for the specified entity descriptor interface with an optional custom using
Declaration
public string WriteFile(EntityDescriptor descriptor, string customUsing, string @namespace = "LemonEdge.Entities")
Parameters
Type | Name | Description |
---|---|---|
EntityDescriptor | descriptor | An entitydescriptor describing the interface. This is loaded dynamically from an interface type, or for a custom object from CreateTempFrom(ICustomObject, IEnumerable<ICustomObjectProperty>) |
string | customUsing | Optionally any custom using statements for the entity to reference specified types |
string | namespace |
Returns
Type | Description |
---|---|
string | A string of the complete c# code for this entity |
WriteProperty(string, Type, Type, string, short, PropertyInfo, ColumnType, bool, bool, bool, ICustomObjectProperty)
Declaration
public string WriteProperty(string propName, Type colType, Type nullableType, string typeModifier, short currentIndent, PropertyInfo forValidations, ColumnType colDef, bool trackChanges, bool isReplicatedKey, bool isSilentLabel, ICustomObjectProperty forCustomValidation)
Parameters
Type | Name | Description |
---|---|---|
string | propName | |
Type | colType | |
Type | nullableType | |
string | typeModifier | |
short | currentIndent | |
PropertyInfo | forValidations | |
ColumnType | colDef | |
bool | trackChanges | |
bool | isReplicatedKey | |
bool | isSilentLabel | |
ICustomObjectProperty | forCustomValidation |
Returns
Type | Description |
---|---|
string |
WriteToFile(ClassFileWriter, EntityDescriptor, IEnumerable<ICustomObjectProperty>)
Write the entity class definition for an existing LemonEdge entity Interface (obtained either from custom .net code (must be marked with EntityDefinitionAttribute) or a ICustomObject)
Declaration
public void WriteToFile(ClassFileWriter writer, EntityDescriptor descriptor, IEnumerable<ICustomObjectProperty> props)
Parameters
Type | Name | Description |
---|---|---|
ClassFileWriter | writer | The writer to add the generated code to |
EntityDescriptor | descriptor | An entity descriptor describing the interface. This is loaded dynamically from an interface type, or for a custom object from CreateTempFrom(ICustomObject, IEnumerable<ICustomObjectProperty>) |
IEnumerable<ICustomObjectProperty> | props | If this interface comes from a ICustomObject then this optionally holds the custom object properties, used to provide custom attributes and validation to the generated interface |