AspNetCoreLocalizationSample | example containing different aspects of ASP.NET | Code Editor library

 by   r-aghaei C# Version: Current License: No License

kandi X-RAY | AspNetCoreLocalizationSample Summary

kandi X-RAY | AspNetCoreLocalizationSample Summary

AspNetCoreLocalizationSample is a C# library typically used in Editor, Code Editor applications. AspNetCoreLocalizationSample has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

An example containing different aspects of ASP.NET Core Localization, including model binding error messages, validation messages, allowing user to change culture at run-time, ... .
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              AspNetCoreLocalizationSample has a low active ecosystem.
              It has 33 star(s) with 6 fork(s). There are no watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 2 open issues and 0 have been closed. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of AspNetCoreLocalizationSample is current.

            kandi-Quality Quality

              AspNetCoreLocalizationSample has 0 bugs and 0 code smells.

            kandi-Security Security

              AspNetCoreLocalizationSample has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              AspNetCoreLocalizationSample code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              AspNetCoreLocalizationSample does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              AspNetCoreLocalizationSample releases are not available. You will need to build from source code and install.
              It has 21223 lines of code, 0 functions and 40 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of AspNetCoreLocalizationSample
            Get all kandi verified functions for this library.

            AspNetCoreLocalizationSample Key Features

            No Key Features are available at this moment for AspNetCoreLocalizationSample.

            AspNetCoreLocalizationSample Examples and Code Snippets

            No Code Snippets are available at this moment for AspNetCoreLocalizationSample.

            Community Discussions

            QUESTION

            What are the costs and possible side effects of calling BuildServiceProvider() in ConfigureServices()
            Asked 2020-Apr-28 at 09:03

            Sometimes, during service registrations, I need to resolve other (already registered) services from the DI container. With containers like Autofac or DryIoc this was no big deal since you could register the service on one line and on the next line you could immediately resolve it.

            But with Microsoft's DI container you need to register the service, then build a service provider and only then you are able resolve the services from that IServiceProvider instance.

            See the accepted answer this SO question: ASP.NET Core Model Binding Error Messages Localization

            ...

            ANSWER

            Answered 2020-Apr-28 at 09:03

            Each service provider has its own cache. Building multiple service provider instances can, therefore, lead to a problem called Torn Lifestyles:

            When multiple [registrations] with the same lifestyle map to the same component, the component is said to have a torn lifestyle. The component is considered torn because each [registration] will have its own cache of the given component, which can potentially result in multiple instances of the component within a single scope. When the registrations are torn the application may be wired incorrectly which could lead to unexpected behavior.

            This means that each service provider will have its own cache of singleton instances. Building multiple service providers from the same source (i.e. from the same service collection) will cause a singleton instance to be created more than once—this breaks the guarantee that there is at most one instance for a given singleton registration.

            But there are other, just as subtle bugs that can appear. For instance, when resolving object graphs that contain scoped dependencies. Building a separate temporary service provider for the creation of an object graph that is stored in the next container might cause those scoped dependencies to be kept alive for the duration of the application. This problem is commonly referred to as Captive Dependencies.

            With containers like Autofac or DryIoc this was no big deal since you could register the service on one line and on the next line you could immediately resolve it.

            This statement implies that there are no problems with trying to resolve instances from the container while the registration phase is still in progress. This, however, is incorrect—altering the container by adding new registrations to it after you already resolved instances is a dangerous practice—it can lead to all sorts of hard to track bugs.

            It is especially because of those hard to track bugs that DI Containers, such as Autofac, Simple Injector, and Microsoft.Extensions.DependencyInjection (MS.DI) prevent you from doing this in the first place. Autofac and MS.DI do this by having registrations made in a 'container builder' (AutoFac's ContainerBuilder and MS.DI's ServiceCollection). Simple Injector, on the other hand, does not make this split. Instead, it locks the container from any modifications after the first instance is resolved. The effect, however, is similar; it prevents you from adding registrations after you resolve.

            The Simple Injector documentation actually contains some decent explanation on why this Register-Resolve-Register pattern is problematic:

            Imagine the scenario where you want to replace some FileLogger component for a different implementation with the same ILogger interface. If there’s a component that directly or indirectly depends on ILogger, replacing the ILogger implementation might not work as you would expect. If the consuming component is registered as singleton, for example, the container should guarantee that only one instance of this component will be created. When you are allowed to change the implementation of ILogger after a singleton instance already holds a reference to the “old” registered implementation the container has two choices—neither of which are correct:

            • Return the cached instance of the consuming component that has a reference to the “wrong” ILogger implementation.
            • Create and cache a new instance of that component and, in doing so, break the promise of the type being registered as a singleton and the guarantee that the container will always return the same instance.

            For this same reason you see that the ASP.NET Core Startup class defines two separate phases:

            • The “Add” phase (the ConfigureServices method), where you add registrations to the “container builder” (a.k.a. IServiceCollection)
            • The “Use” phase (the Configure method), where you state you want to use MVC by setting up routes. During this phase, the IServiceCollection has been turned into a IServiceProvider and those services can even be method injected into the Configure method.

            The general solution, therefore, is to postpone resolving services (like your IStringLocalizerFactory) until the “Use” phase, and with it postpone the final configuration of things that depend on the resolving of services.

            This, unfortunately, seems to cause a chicken or the egg causality dilemma when it comes to configuring the ModelBindingMessageProvider because:

            • Configuring the ModelBindingMessageProvider requires the use of the MvcOptions class.
            • The MvcOptions class is only available during the “Add” (ConfigureServices) phase.
            • During the “Add” phase there is no access to an IStringLocalizerFactory and no access to a container or service provider and resolving it can’t be postponed by creating such value using a Lazy.
            • During the “Use” phase, IStringLocalizerFactory is available, but at that point, there is no MvcOptions any longer that you can use to configure the ModelBindingMessageProvider.

            The only way around this impasse is by using private fields inside the Startup class and use them in the closure of AddOptions. For instance:

            Source https://stackoverflow.com/questions/56042989

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install AspNetCoreLocalizationSample

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/r-aghaei/AspNetCoreLocalizationSample.git

          • CLI

            gh repo clone r-aghaei/AspNetCoreLocalizationSample

          • sshUrl

            git@github.com:r-aghaei/AspNetCoreLocalizationSample.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link