dadhi / DryIoc

DryIoc is fast, small, full-featured IoC Container for .NET
MIT License
982 stars 122 forks source link

Breaking changes in MefAttributedModel #599

Closed yallie closed 8 months ago

yallie commented 8 months ago

Hi, Maksim!

There is a class in MefAttributedModel library that is used as a serializable container for exported registrations: ExportedRegistrationInfo

I use it in my app for registrations not available at compile time. Scripted components are stored in the database with their serialized registrations. On startup, I load and deserialize registrations and register in DryIoc container. Serialized registrations allow to compile scripts on-demand rather than up-front.

When upgrading from version 4.8.7 I noticed that some properties became internal. So I can't deserialize my registrations anymore 😮

image

I guess they are not public to protect the integrity of registrations. But does it make sense in a serializable DTO class to have internal properties? Can we revert the change and have them all public? Or am I missing something obvious?

yallie commented 8 months ago

And/or can we make Flags public?

/// <summary>Serializable DTO of all registration information.</summary>
public sealed class ExportedRegistrationInfo
{
  public ExportInfo[] Exports;
  public Type ImplementationType;
  public string ImplementationTypeFullName;
  public bool IsLazy => ImplementationTypeFullName != null;
  public ReuseInfo Reuse;

  public Setup.Settings Flags; // <--------------- here

  public bool UseParentReuse
  {
    get => (Flags & Setup.Settings.UseParentReuse) != 0;
    set => Flags = value ? Flags | Setup.Settings.UseParentReuse: Flags & ~Setup.Settings.UseParentReuse;
  }
...
dadhi commented 8 months ago

@yallie Done :) Will release a new version shortly

dadhi commented 8 months ago

@yallie I have published to Nuget DryIoc v5.4.2 and DryIoc.MefAttributedModel v7.0.2

yallie commented 8 months ago

Thanks a lot! 👍