I currently evaluate dotConnect with Entity Framework. I use dotConnect Beta 5.20.24.0.
I am trying to generate a edmx file from an oracle database. If i use GenerateStoreMetadata without filters, it works perfectly. However, if I use a filter to select only a few tables, GenerateStoreMetadata creates an empty edmx. Fruthermore there is no exception thrown.
The selected tables exsist because if I insert into the filter a table which does not exsist an exception is thrown.
The Method LoadFilter() loads the tablenames from the app.config.
In the Main() Method the generation of ssdl, msl and csdl happens.
Code: Select all
private static IEnumerable LoadFilter()
{
IList entries = new List();
XmlDocument doc = new XmlDocument();
doc.Load("tables.xml");
XmlNodeList nodes = doc.SelectSingleNode("tables").SelectNodes("table");
if (nodes.Count > 0)
{
foreach (XmlElement elm in nodes)
{
entries.Add(new EntityStoreSchemaFilterEntry(null, null, elm.Attributes["name"].Value));
}
}
return entries;
}
static void Main(string[] args)
{
IList ssdlErrors = null;
IList csdlAndMslErrors = null;
IEnumerable filters = LoadFilter();
// generate the SSDL
string ssdlNamespace = storeName + "Model.Store";
EntityStoreSchemaGenerator essg =
new EntityStoreSchemaGenerator(
oracleProvider, ConfigurationManager.ConnectionStrings["oracle"].ConnectionString, ssdlNamespace);
ssdlErrors = essg.GenerateStoreMetadata(filters);
// write out errors
if ((ssdlErrors != null && ssdlErrors.Count > 0))
{
System.Console.WriteLine("Errors occurred during generation:");
WriteErrors(ssdlErrors);
//return;
}
// write the SSDL to a string
StringWriter ssdl = new StringWriter();
XmlWriter ssdlxw = XmlWriter.Create(ssdl);
essg.WriteStoreSchema(ssdlxw);
ssdlxw.Flush();
// generate the CSDL
string csdlNamespace = storeName + "Model";
string csdlEntityContainerName = storeName + "Entities";
EntityModelSchemaGenerator emsg =
new EntityModelSchemaGenerator(
essg.EntityContainer, csdlNamespace, csdlEntityContainerName);
csdlAndMslErrors = emsg.GenerateMetadata();
// write out errors
if (csdlAndMslErrors != null && csdlAndMslErrors.Count > 0)
{
System.Console.WriteLine("Errors occurred during generation:");
WriteErrors(csdlAndMslErrors);
//return;
}
// write CSDL to a string
StringWriter csdl = new StringWriter();
XmlWriter csdlxw = XmlWriter.Create(csdl);
emsg.WriteModelSchema(csdlxw);
csdlxw.Flush();
// write MSL to a string
StringWriter msl = new StringWriter();
XmlWriter mslxw = XmlWriter.Create(msl);
emsg.WriteStorageMapping(mslxw);
mslxw.Flush();
// write csdl, ssdl & msl to the EDMX file
ToEdmx(
csdl.ToString(), ssdl.ToString(), msl.ToString(), new FileInfo(
"test" + ".edmx"));
}