示例#1
0
        /// <summary>
        /// Looks at all loaded assemblies and adds EntityDescription for each entity found
        /// </summary>
        private void AddEntityDescriptions()
        {
            var entityDescription = new EntityDescription();

            foreach (KeyValuePair <Assembly, bool> pair in _loadedAssemblies)
            {
                // Performance optimization: standard Microsoft assemblies are excluded from this search
                if (pair.Value)
                {
                    // Utility autorecovers and logs for common exceptions
                    var types = AssemblyUtilities.GetExportedTypes(pair.Key, _logger);

                    foreach (var type in types)
                    {
                        try
                        {
                            entityDescription.TryAddEntityType(type);
                        }
                        catch (Exception e)
                        {
                            LogWarning(e.ToString());
                        }
                    }
                }
            }

            entityDescription.Initialize();

            if (entityDescription.EntityTypes.Any())
            {
                _entityDescriptions.Add(entityDescription);
            }
        }
示例#2
0
        private void AddEntityDescriptions(IEnumerable <Type> entityTypes)
        {
            var entityDescription = new EntityDescription();

            foreach (var entityType in entityTypes)
            {
                try
                {
                    entityDescription.AddEntityType(entityType);
                }
                catch (Exception e)
                {
                    LogWarning(e.Message);
                }
            }

            entityDescription.Initialize();

            if (entityDescription.EntityTypes.Any())
            {
                _entityDescriptions.Add(entityDescription);
            }
        }