예제 #1
0
        public static IReadOnlyDictionary <string, IEntity> ToLocalNames <T>(this IEntityRepository repository,
                                                                             IReadOnlyDictionary <string, Guid> entityKeys)
        {
            var entityDictionary = new Dictionary <string, IEntity>();

            foreach (var keyValuePair in entityKeys)
            {
                if (!repository.ContainsEntity(keyValuePair.Value))
                {
                    throw new Exception(String.Format("Entity with guid {0} and local name {1} not found in repository", keyValuePair.Value, keyValuePair.Key));
                }
                entityDictionary[keyValuePair.Key] = repository.GetEntity(keyValuePair.Value);
            }
            return(new ReadOnlyDictionary <string, IEntity>(entityDictionary));
        }