using CatLib; using CatLib.Container; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TinaX.Services; namespace TinaX.Container { public interface IServiceContainer { Application CatApplication { get; } #region Get Services /// /// Get Service | 获取服务 /// /// /// /// TService Get(params object[] userParams); /// /// Get Service | 获取服务 /// /// /// /// object Get(Type type, params object[] userParams); object Get(string serviceName, params object[] userParams); bool TryGet(out TService service, params object[] userParams); bool TryGet(Type type, out object service, params object[] userParams); bool TryGet(string serviceName, out object service, params object[] userParams); bool TryGetBuildInService(out TBuiltInService service) where TBuiltInService : IBuiltInService; bool TryGetBuildInService(Type type, out object service); bool TryGetBuildInService(string serviceName, out object service); #endregion #region Bind Services IBindData Singleton(); IBindData Singleton(); bool SingletonIf(out IBindData bindData); bool SingletonIf(out IBindData bindData); IBindData Bind(); IBindData Bind(); IBindData Bind(string serviceName, Type type, bool isStatic); bool BindIf(out IBindData bindData); bool BindIf(out IBindData bindData); bool BindIf(string serviceName, Type concreate, bool isStatic, out IBindData bindData); IBindData BindBuiltInService() where TBuiltInService : IBuiltInService; IBindData BindBuiltInService() where TBuiltInService : IBuiltInService; object Instance(string service, object instance); object Instance(object instance); #endregion #region Unbind Services void Unbind(); void Unbind(Type type); void Unbind(string serviceName); #endregion #region Inject /// /// Dependency injection on a given object /// 对给定的对象进行依赖注入 /// /// void Inject(object target); #endregion string Type2ServiceName(Type type); string Type2ServiceName(); } }