Shared/Kernelx.ClientContexts/Contexts/ContextOptions.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using Kernelx.Contexts.Core.SequeGenerator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kernelx.Data;

namespace Kernelx.Contexts
{

#if NET35  

    internal enum ServiceLifetime
    {
        /// <summary>
        /// 单例
        /// </summary>
        Singleton,

        /// <summary>
        /// 范围内
        /// </summary>
        Scoped,

        /// <summary>
        /// 瞬时
        /// </summary>
        Transient
    }
     
    internal class ServiceDescriptor
    {
        public ServiceDescriptor(Type serviceType, Type implementationType, ServiceLifetime lifetime)
        {
            ServiceType = serviceType;
            ImplementationType = implementationType;
            Lifetime = lifetime;
        }

        public ServiceDescriptor(Type serviceType, Func<IServiceProvider, object> factory, ServiceLifetime lifetime)
        {
            ServiceType=serviceType;
            ImplementationFactory = factory;
            Lifetime = lifetime;
        }

        public ServiceDescriptor(Type serviceType, object instance)
        {
            ServiceType = serviceType;
            ImplementationInstance = instance;
            Lifetime = ServiceLifetime.Singleton;
        }


        public ServiceLifetime Lifetime {get;private set;}

        public Type ServiceType { get; private set; }
         
        public Type ImplementationType { get; private set; }

后面还有 96 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。