Пример #1
0
            public bool ProbeAssemblies(IEnumerable <Assembly> assembliesToProbe)
            {
                // ToList is important on next line
                var assemblies = assembliesToProbe.Except(_probedAssemblies).ToList();

                if (assemblies.Any())
                {
                    assemblies.ForEach(a => _probedAssemblies.Add(a));
                    TypeFns.GetTypesImplementing(typeof(IEntity), assemblies).ForEach(t => GetStructuralType(t));
                    TypeFns.GetTypesImplementing(typeof(IComplexObject), assemblies).ForEach(t => GetStructuralType(t));
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
Пример #2
0
 /// <summary>
 /// Tell's Breeze to probe the specified assemblies and automatically discover any
 /// Entity types, Complex types, Validators, NamingConventions and any other types
 /// for which a type discovery action is registered.
 /// </summary>
 /// <param name="assembliesToProbe"></param>
 /// <returns></returns>
 public bool ProbeAssemblies(params Assembly[] assembliesToProbe)
 {
     lock (_typeDiscoveryActions) {
         var assemblies = assembliesToProbe.Except(_probedAssemblies).ToList();
         if (assemblies.Any())
         {
             assemblies.ForEach(asm => {
                 _probedAssemblies.Add(asm);
                 _typeDiscoveryActions.Where(tpl => tpl.Item3 == null || tpl.Item3(asm))
                 .ForEach(tpl => {
                     var type   = tpl.Item1;
                     var action = tpl.Item2;
                     TypeFns.GetTypesImplementing(type, asm).ForEach(action);
                 });
             });
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }