Generate a special dtos

I was wondering if there was a way to ask x to generate a class as it does now “x cs …” with a custom parameter that could be intercepted on the server so that i could emit a simple partial class with a decorative attribute that would handle property changed on my POCOs i.e.
[AddINotifyPropertyChangedInterface]
public partial class Listing {}

I really don’t want to add it to the class all the time just when i ask for it i would like to be able to generate it as a “dtos.partial.cs”. Hope this doesnt sound dumb.

Derek

It supports emitting custom code using declarative Emit attributes but that’s not going to let you dynamically alter code based on a request.

I’d suggest to take advantage of the partial DTO classes and extending the DTOs in your partial class that sits along side the generated DTOs otherwise create a script that calls x cs to update the DTOs and have your script do any post code processing.

That was acutally what i was suggesting was a separate partial file but one that would be able to point at the same mechanism that generates the entire catalog of dtos that would only return the class definition with no other class info. I know i use the nativetypesfeature to determine how other attributes are emitted in the Config.AppHost.cs

Was wondering if there was a similar mechanism

I’m not clear on what this is asking for but Native Types Feature only generates a single file for your DTOs that has limited code generation customization available, the Emit attributes and the static PreTypeFilter, InnerTypeFilter, PostTypeFilter, PrePropertyFilter. PostPropertyFilter static delegates on CSharpGenerator but none of these let you customize generation per request.

If you need something other code generation, either do it on the client with a script that calls x cs to update the DTOs then apply any code transformations you want on the generated DTOs or create your own API that does it by returning a string. You can access the Metadata of your services from HostContext.Metadata.