Friday, April 3, 2020

How do I support the DefaultName attribute of Autofac.Extras.Configuration when porting code from .NET Framework to .NET Core?

I don't know yet. When I drill in their, decompiled with JetBrains decompiler, the attribute reads like so:

using System;
namespace Autofac.Extras.Configuration
{
   [AttributeUsage(AttributeTargets.Class)]
   public sealed class DefaultNameAttribute : Attribute
   {
      public DefaultNameAttribute(string name);
      public string Name { get; private set; }
   }
}

 
 

Does that mean I may just recreate it like this?

using System;
namespace Anything.You.Like.Here
{
   [AttributeUsage(AttributeTargets.Class)]
   public sealed class DefaultNameAttribute : Attribute
   {
      public DefaultNameAttribute(string name)
      {
         Name = name;
      }
      public string Name { get; private set; }
   }
}

 
 

Will the .NET Core version of Autofac honor this?

No comments:

Post a Comment