Hi Folks,
I'm playing around with the trial version to see if it meets my needs. So far I really like it however I have one major issue. In my existing application each entity has its own directory in which the .cs file is stored. So for instance the Domain.Address.Address entity is stored in a directory called Address in the Domain project. It looks like you can specify where the entities are stored in the templates properties but it looks like you can only specify a directory to dump it all. Is that as flexible as it gets?
Thanx!
Saving entity output
Re: Saving entity output
You should modify a predefined template (right click on it > Copy to Model Folder).edowney wrote: In my existing application each entity has its own directory in which the .cs file is stored.
Assuming that you are working with Devart Entity Model (*.edml) and its EntityObject template, open the template and implement the following changes:
1. Replace
Code: Select all
foreach (EntityClass cls in model.Classes) {
if (FilePerClass) {
string rootFileName = baseFileName + "." + cls.Name;
if (GeneratePartialClass) {
output.Extension = ".cs";
output.PushOutputRedirection(EntitiesOutput, "", rootFileName, OverwriteMode.None);
GenerateFileHeader(false);
Code: Select all
foreach (EntityClass cls in model.Classes) {
OutputInfo classOutput = new OutputInfo();
if (string.IsNullOrEmpty(EntitiesOutput.Project)){
classOutput.DestinationFolder = Path.Combine(EntitiesOutput.DestinationFolder, cls.Name);
Directory.CreateDirectory(classOutput.DestinationFolder);
}
else {
classOutput.Project = EntitiesOutput.Project;
classOutput.ProjectFolder = Path.Combine(EntitiesOutput.ProjectFolder, cls.Name);
}
if (FilePerClass) {
string rootFileName = baseFileName + "." + cls.Name;
if (GeneratePartialClass) {
output.Extension = ".cs";
output.PushOutputRedirection(classOutput, "", rootFileName, OverwriteMode.None);
GenerateFileHeader(false);
Code: Select all
if (GeneratePartialClass)
output.PushOutputRedirection(EntitiesOutput, rootFileName, rootFileName +
".Generated");
else
output.PushOutputRedirection(EntitiesOutput, rootFileName);
Code: Select all
if (GeneratePartialClass)
output.PushOutputRedirection(classOutput, rootFileName, rootFileName + ".Generated");
else
output.PushOutputRedirection(classOutput, rootFileName);
1. Set the File Per Class property of the template to True.
2. If you are using Entity Developer which is integrated in Visual Studio, you should explicitly assign a value to the EntitiesOutput.Project property of the template.