Entity Framework Core create code-first base from xsd file

c# entity-framework entity-framework-core xsd xsd2code

Question

I have a xsd file and I need create MS SQL database from this file. I use code-first and try create classes for migration. I try use xsd2code++ and XmlClassSchemaGenerator, but generated classes contains arrays of primitive type and no connection between classes.

'The property 'property_name' could not be mapped, because it is of type 'List<'string>' which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.'

Is there any way to create database automatically, because xsd file is large.

1
0
7/9/2019 12:15:04 PM

Popular Answer

There is no direct way to create a database table from a XSD. you can however create a more readable .cs file.

just follow these steps:

  1. load your XSD into visual studio
  2. open it my double clicking or right click and then click open
  3. Click the "XML Schema explorer" button at the top of the page.
  4. right click the last item in you XSD file then press "Generate sample XML"

from here on you can access all the fields within your XSD.

0
7/9/2019 12:31:29 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow