예제 #1
0
 internal static IEnumerable <T> Cast <T>(JsonApiResourceObject data, JsonApiResource apiResource)
 {
     return(new List <T> {
         (T)data.ToObject(apiResource, typeof(T))
     });
 }
예제 #2
0
 public static T_Result ToObject <T_Result, T_Resource>(this JsonApiResourceObject resourceObject, T_Resource resource) where T_Resource : JsonApiResource
 {
     return((T_Result)resourceObject.ToObject(resource, typeof(T_Result)));
 }
예제 #3
0
 /// <summary>
 /// Converts the resource to a object.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static T ToObject <T>(this JsonApiResourceObject resourceObject, bool processRelations = true) where T : IJsonApiDataModel
 {
     return((T)resourceObject.ToObject(typeof(T), processRelations));
 }
예제 #4
0
 public static T_Result ToObject <T_Result, T_Resource>(this JsonApiResourceObject resourceObject) where T_Resource : JsonApiResource
 {
     return((T_Result)resourceObject.ToObject(Activator.CreateInstance <T_Resource>(), typeof(T_Result)));
 }