public HypermediaCustomersRoot(ICustomerRepository customerRepository) { this.customerRepository = customerRepository; CreateCustomerAction = new HypermediaFunction<CreateCustomerParameters, Task<Customer>>(CanCreateCustomer, DoCreateCustomer); CreateQueryAction = new HypermediaAction<CustomerQuery>(CanNewQuery); // Add Links: var allQuery = new CustomerQuery(); Links.Add(DefaultHypermediaRelations.Queries.All, new HypermediaObjectQueryReference(typeof(HypermediaCustomerQueryResult), allQuery)); // This Link uses a reference to a HypermediaObject without actually building it. It Gives the type and the value which is used do identify the Entity. // The key will be used while resolving routes in the Formatter. // links to the HypermediaCustomer with Id = 1 Links.Add("BestCustomer", new HypermediaObjectKeyReference(typeof(HypermediaCustomer), 1)); // Workaround in case a external reference is needed which can not be build by the framework Links.Add("GreatSite", new ExternalReference(new Uri("http://www.example.com/"))); }
public DesignHto() { NewDesignQuery = new HypermediaAction <BlueprintQueryParameters>(() => true); }