This question is locked. New answers and comments are not allowed.
I'm trying to extend the generate WCF plain service with some of my own custom logic. I want to add a function that takes a DTO object, gets a list of entities from a navigation property and runs a query against the repository based on the entities returned from the navigation property.
I've added a method to the .svc and to the service.cs layer.
How do I get my Dto's be loaded with the navigation properties? Or is the way I'm going about extending the service all wrong?
I've excluded code added to the IProductService and the [OperationContract] for ReadProductByBrandGroup
UPDATE: Did a little more digging and found the solution. http://www.telerik.com/help/openaccess-orm/developer-guide-wcfservices-plain-service-handle-relationships.html
I've added a method to the .svc and to the service.cs layer.
How do I get my Dto's be loaded with the navigation properties? Or is the way I'm going about extending the service all wrong?
// method added to the .svc
public
IEnumerable<ProductDto> ReadProductByBrandGroup(BrandGroupDto brand){
var mappings = brand.BrandMappings.ToList();
//this should return a list of strings but instead returns null
return
this
.ProductService.FindProductsByBrandGroup(brand);
//this works
}
//method added ProductService class in the service.cs layer
public
IEnumerable<ProductDto> FindProductsByBrandGroup(BrandGroupDto brandGroup)
{
var bMaps = brandGroup.BrandMappings;
List<
string
> brandNames = bMaps.Select(x=>x.BrandName).ToList<
string
>() ;
var query =
this
.Find(x => brandNames.Contains(x.BrandName));
return
query;
}
I've excluded code added to the IProductService and the [OperationContract] for ReadProductByBrandGroup
UPDATE: Did a little more digging and found the solution. http://www.telerik.com/help/openaccess-orm/developer-guide-wcfservices-plain-service-handle-relationships.html
(ps: um how do you remove formatted code blocks from your post?