Base solution for your next web application
Open Closed

External repositories structure - JSON/XML #2004


User avatar
0
marcosli created

Hello guys,

I'm thinking of building a structure for external repositories to consume xml and json, however I would like to know if anyone here has already done this or have any ideas whatsoever to preserve an aspnetzero structure?

Thank you.


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    As I understand, you just need to create arbitrary classes. An example would be:

    public interface IProductRepository
    {
        List<Product> GetAll();
    }
    
    public class ProductRepository : IProductRepository, ITransientDependency
    {
        public List<Product> GetAll()
        {
            //TOD: get from XML/JSON
        }
    }
    

    If you like, you may not use IProductRepository, but I suggest that abstraction.