Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8151265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:19:35+00:00 2026-06-06T15:19:35+00:00

Unity.AutoRegistration works fine when a type name matches an interface name, for example, TClass

  • 0

Unity.AutoRegistration works fine when a type name matches an interface name, for example, TClass and ITClass. I want interface names go without prefix “T”, like IClass and need that IClass to match TClass.

But when I rename the interface, the auto-registration fails. Do I have to match the type/interface names, or is there a way to accomplish my need?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:19:37+00:00Added an answer on June 6, 2026 at 3:19 pm

    After consulting with the author, here is the required code:

    UContainer
        .ConfigureAutoRegistration()
        .LoadAssemblyFrom(Assembly.GetEntryAssembly().Location)
        .ExcludeSystemAssemblies()
        .Include(If.ImplementsITypeName, Then.Register())
        .Include(
            type => type.GetInterfaces().Any(i => i.Name.StartsWith("I") && i.Name.Substring(1) == type.Name.Substring(1)), Then.Register())
        .Include(If.ImplementsSingleInterface, Then.Register())
        .ApplyAutoRegistration();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use Unity interception for an interface without an implementation, so that
I want configure Unity to resolve an interface, say ITest , to a struct,
A FileLoadException when using Unity generally means that a type has been configured for
I'm doing a Unity-iPhone project, but want to automatically add some native code and
I'm new using Unity and, if I understood correctly, it works using C# language.
Using Unity, I'd like to automatically register all interface/class combinations in an assembly based
I have a 3D unity vector pointing in a certain direction. Now I want
I want to use unity for a polymorphic event aggregation/handling where handlers are registered
In unity, when configuring a type, you can specify more than one typeConfig if
I am using Unity and Unity.AutoRegistration . This line for Unity: unityContainer.RegisterType(typeof(IAction<>), typeof(Action<>)); effectively

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.