示例#1
0
 /// <summary>
 /// Recupera a relação de todos os filhos dinâmicos.
 /// </summary>
 /// <returns></returns>
 public virtual IEnumerable <Colosoft.Reflection.TypeName> GetAllTypes()
 {
     if (_types == null)
     {
         ServiceLocatorValidator.Validate();
         var loader = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IEntityDynamicChildTypesLoader>();
         _types = loader.Load(typeof(TModel)).ToList();
     }
     return(_types);
 }
示例#2
0
 /// <summary>
 /// Recarrega as configurações.
 /// </summary>
 private static bool ReloadSettings()
 {
     lock (_lockTypeSchema)
     {
         ServiceLocatorValidator.Validate();
         if (_typeSchema == null)
         {
             try
             {
                 _typeSchema = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <ITypeSchema>();
             }
             catch
             {
                 return(false);
             }
             return(true);
         }
         else
         {
             _typeSchema.Reload();
             return(true);
         }
     }
 }
示例#3
0
 /// <summary>
 /// Initializa os dados do membership.
 /// </summary>
 private static void Initialize()
 {
     if (_initialized)
     {
         if (_initializeException != null)
         {
             throw _initializeException;
         }
     }
     else
     {
         if (_initializeException != null)
         {
             throw _initializeException;
         }
         lock (_lock)
         {
             if (_initialized)
             {
                 if (_initializeException != null)
                 {
                     throw _initializeException;
                 }
             }
             else
             {
                 try
                 {
                     _providers = new List <IRoleProvider>();
                     ServiceLocatorValidator.Validate();
                     var instances = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetAllInstances <IRoleProvider>();
                     foreach (var provider in instances)
                     {
                         _providers.Add(provider);
                     }
                     if (string.IsNullOrEmpty(DefaultProviderName))
                     {
                         _provider = _providers.FirstOrDefault();
                         if (_provider != null)
                         {
                             DefaultProviderName = _provider.Name;
                         }
                     }
                     else
                     {
                         _provider = _providers.Find(f => f.Name == DefaultProviderName);
                     }
                 }
                 catch (Exception exception)
                 {
                     _initializeException = exception;
                     throw;
                 }
                 if (_provider == null)
                 {
                     _initializeException = new InvalidOperationException(Properties.Resources.InvalidOperation_DefaultRolesProviderNotFound);
                     throw _initializeException;
                 }
                 _initialized = true;
             }
         }
     }
 }