Ejemplo n.º 1
0
 internal static void ProjectionEnsureEntryAvailableOfType(ODataEntityMaterializer materializer, MaterializerEntry entry, Type requiredType)
 {
     if (entry.Id == null)
     {
         throw System.Data.Services.Client.Error.InvalidOperation(System.Data.Services.Client.Strings.Deserialize_MissingIdElement);
     }
     if (!materializer.TryResolveAsCreated(entry) && !materializer.TryResolveFromContext(entry, requiredType))
     {
         materializer.ResolveByCreatingWithType(entry, requiredType);
     }
     else if (!requiredType.IsAssignableFrom(entry.ResolvedObject.GetType()))
     {
         throw System.Data.Services.Client.Error.InvalidOperation(System.Data.Services.Client.Strings.Deserialize_Current(requiredType, entry.ResolvedObject.GetType()));
     }
 }