Entity partial classes
Entity partial classes are a feature that allows you to extend the functionality of your entities without modifying the generated code. For example to implement interfaces.
See Partial classes for more information.
In Neos Studio
A new node 'Partial classes' is available in the entity tree. This node allows you to create a partial class for the selected entity.
The name of the partial class will be use to create the file name.
The naming convention
The naming convention for partial classes is as follows:
{MyEntity}.{Name}.cs
The content
By default, the content of the partial class is as follows:
namespace EntityNamespace.Domain.Entities
{
public partial class MyEntity
{
}
}
The namespace must be the same as the one used for the entity. The name of the class must be the same as the name of the entity.
Where the partial class file is created
The partial class file is created in specific folders for the additional files of a module. The folder structure is as follows:
{ClusterDirectory}/
modules/
{ModuleName}/
additionalFiles/
PartialClasses/
{MyEntity}.{Name}.cs
In Visual Studio
The partial class files are not in the same folder as the generated entity files. To include the partial class files in the project, the generation of project add automatically a link to the partial class folders.
The following ItemGroup is added to the project file:
<ItemGroup>
<Compile Include="../../modules/MyModule/additionalFiles/PartialClasses/Entities/**/*.cs">
<Link>AdditionalFiles/PartialClasses/Entities/%(RecursiveDir)/%(FileName)%(Extension)</Link>
</Compile>
</ItemGroup>
So the partial class can be modified in Visual Studio and the changes will be taken into account when the project is built.