Skip to content

Conversation

@DocSvartz
Copy link
Contributor

No description provided.

@DocSvartz DocSvartz changed the title Fix issue #723 - Add Support ignore member constructor creation in DynamicTypeGenerator Fix issue #723 - Add Support ignore member when creating a constructor in DynamicTypeGenerator Jan 7, 2025
@DocSvartz
Copy link
Contributor Author

Hello @andrerav .

If the interface contains at least one property with a non-public setter, then all properties will be initialized via the constructor.
Custom logic for ignoring them is not supported.

I found a way to add this support, but maybe it was not intended that way?

builder.DefineMethodOverride(classMethod, interfaceMethod);
}

private static List<FieldBuilder> DropIgnorMemebers(List<FieldBuilder> fields)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly a typo: DropIgnoredMembers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes of course. This is not the final solution, you could say MVP :)

private static readonly ConcurrentDictionary<Type, Type> _generated = new ConcurrentDictionary<Type, Type>();
private static int _generatedCounter;

private static IgnoreDictionary ignoreMembers;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be nullable?

@DocSvartz DocSvartz closed this Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants