Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: XML. Create relationships. XML. Create relationships.To: NULL Date: 7/13/2009 5:49:00 AM Hello,
I am using XML files to save data for Products and Brands and I have
the following (example):
<Products>
<Product>
<Id>1</Id>
<Name>Series 3</Name>
<Brand>
<Id>1</Id>
<Name>BMW</Name>
</Brand>
</Product>
</Products>
And on Brands I have:
<Brands>
<Brand>
<BrandId>1</BrandId>
<Name>BMW</Name>
</Brand>
</Brands>
I think that on products I should change it to:
<Product>
<ProductId>1</ProductId>
<Name>Series 3</Name>
<BrandId>1</BrandId>
</Product>
Replicating how a database works and then using LINQ to build the
Product object that contains Brand object.
This way if a Brand changes I don't need to change all the records in
Products.
What do you think?
And if I have a Many to Many relationship I could do something like:
<Products>
<Product>
<ProductId>1</ProductId>
<Name>Series 3</Name>
</Product>
</Products>
<Brands>
<Brand>
<BrandId>1</BrandId>
<Name>BMW</Name>
</Brand>
</Brands>
<ProductsBrands>
<ProductBrand>
<ProductId>1</ProductId>
<BrandId>1</BrandId>
</ProductBrand>
<ProductsBrands>
Is this the way to go?
Thanks,
Miguel
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
