private static IdentityInfo GetIdentityInfo(AssemblyMappingInfo assemblyMappingInfo, Type entityType,
                                                    PropertyInfo identityProperty, IdentifierAttribute identifierAttr)
        {
            string baseUri = identifierAttr == null || identifierAttr.BaseAddress == null
                                 ? Constants.GeneratedUriPrefix
                                 : assemblyMappingInfo.ResolveIdentifier(identifierAttr.BaseAddress);

            if (identifierAttr != null && identifierAttr.KeyProperties != null && identifierAttr.KeyProperties.Length > 0)
            {
                var keyProperties = new PropertyInfo[identifierAttr.KeyProperties.Length];
                for (var i = 0; i < identifierAttr.KeyProperties.Length; i++)
                {
                    var property = entityType.GetProperty(identifierAttr.KeyProperties[i]);
                    if (property == null)
                    {
                        throw new ReflectionMappingException(
                                  String.Format("Could not find key property {0} on type {1}.", identifierAttr.KeyProperties[i], entityType.FullName));
                    }
                    keyProperties[i] = property;
                }
                IKeyConverter keyConverter = null;
                if (identifierAttr.KeyConverterType != null)
                {
                    keyConverter = Activator.CreateInstance(identifierAttr.KeyConverterType) as IKeyConverter;
                    if (keyConverter == null)
                    {
                        throw new ReflectionMappingException(
                                  String.Format("Could not instantiate type {0} as a key converter for entity type {1}. Ensure that this type implements the IKeyConverter interface.",
                                                identifierAttr.KeyConverterType.FullName, entityType.FullName));
                    }
                }
                return(new IdentityInfo(baseUri, identityProperty, keyProperties,
                                        identifierAttr.KeySeparator ?? Constants.DefaultKeySeparator,
                                        keyConverter ?? new DefaultKeyConverter()));
            }
            return(new IdentityInfo(baseUri, identityProperty, null, null, null));
        }
 private static IdentityInfo GetIdentityInfo(AssemblyMappingInfo assemblyMappingInfo, Type entityType,
     PropertyInfo identityProperty, IdentifierAttribute identifierAttr)
 {
     string baseUri = identifierAttr == null || String.IsNullOrWhiteSpace(identifierAttr.BaseAddress)
                          ? Constants.GeneratedUriPrefix
                          : assemblyMappingInfo.ResolveIdentifier(identifierAttr.BaseAddress);
     if (identifierAttr != null && identifierAttr.KeyProperties != null && identifierAttr.KeyProperties.Length > 0)
     {
         var keyProperties = new PropertyInfo[identifierAttr.KeyProperties.Length];
         for (var i = 0; i < identifierAttr.KeyProperties.Length; i++)
         {
             var property = entityType.GetProperty(identifierAttr.KeyProperties[i]);
             if (property == null)
             {
                 throw new ReflectionMappingException(
                     String.Format("Could not find key property {0} on type {1}.", identifierAttr.KeyProperties[i], entityType.FullName));
             }
             keyProperties[i] = property;
         }
         IKeyConverter keyConverter = null;
         if (identifierAttr.KeyConverterType != null)
         {
             keyConverter = Activator.CreateInstance(identifierAttr.KeyConverterType) as IKeyConverter;
             if (keyConverter == null)
             {
                 throw new ReflectionMappingException(
                     String.Format("Could not instantiate type {0} as a key converter for entity type {1}. Ensure that this type implements the IKeyConverter interface.",
                                   identifierAttr.KeyConverterType.FullName, entityType.FullName));
             }
         }
         return new IdentityInfo(baseUri, identityProperty, keyProperties,
                                 identifierAttr.KeySeparator ?? Constants.DefaultKeySeparator,
                                 keyConverter ?? new DefaultKeyConverter());
     }
     return new IdentityInfo(baseUri, identityProperty, null, null, null);
 }