public object GetService(Type type)
 {
     if (ServiceLocator.Current.IsRegistered(type))
     {
         return(ServiceLocator.GetService(type));
     }
     else
     {
         return(ServiceLocator.GetService <IServiceProxyFactory>().CreateProxy(type));
     }
 }
 public object GetService(string key, Type type)
 {
     if (ServiceLocator.Current.IsRegisteredWithKey(key, type))
     {
         return(ServiceLocator.GetService(key, type));
     }
     else
     {
         return(ServiceLocator.GetService <IServiceProxyFactory>().CreateProxy(key, type));
     }
 }
 public T GetService <T>() where T : class
 {
     if (ServiceLocator.Current.IsRegistered <T>())
     {
         return(ServiceLocator.GetService <T>());
     }
     else
     {
         return(ServiceLocator.GetService <IServiceProxyFactory>().CreateProxy <T>());
     }
 }
 public T CreateProxy <T>() where T : class
 {
     return(ServiceLocator.GetService <IServiceProxyFactory>().CreateProxy <T>());
 }
 public object CreateProxy(string key, Type type)
 {
     return(ServiceLocator.GetService <IServiceProxyFactory>().CreateProxy(key, type));
 }
 public object CreateProxy(Type type)
 {
     return(ServiceLocator.GetService <IServiceProxyFactory>().CreateProxy(type));
 }
Example #7
0
        public static T DeepCopy <T>(this object obj)
        {
            var serializer = ServiceLocator.GetService <ISerializer <string> >();

            return((T)serializer.Deserialize(serializer.Serialize(obj), typeof(T)));
        }