Пример #1
0
        /// <summary>
        /// Updates (or adds) an HATEOAS registration
        /// </summary>
        /// <param name="configuration">HTTP configuration</param>
        /// <param name="registration">HATEOAS registration</param>
        public static void UpdateRegistration(this IHttpConfiguration configuration, IHateoasRegistration registration)
        {
            var definition = configuration.GetRegistrationFor(registration.Model, registration.Relation, registration.IsCollection);

            if (definition == null)
            {
                configuration.AddRegistration(registration);
            }
            else
            {
                definition.Expression = registration.Expression;
            }
        }
Пример #2
0
 public void Add(IHateoasRegistration registration)
 {
     //Registrations.Add(registration);
     _httpConfiguration.AddRegistration(registration);
 }