No schema encountered with 'Base' namespace when running POCO entity generator with a CSDL file which imports a namespace from another CSDL file - entity-framework

I'm getting this error "No schema encountered with 'Base' namespace" when running POCO entity generator with a CSDL file which imports a namespace from another CSDL file.
Both CSDL files have been moved to different folders outside the project folder. This because I had to edit the Administracion.csdl file to import the namespace from the "Base" CSDL file.
The "Administracion.csdl" file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="Administracion" Alias="Self" p1:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:p1="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
<Using Namespace="Base" Alias="Base" />
<EntityContainer Name="AdministracionEntities" p1:LazyLoadingEnabled="true">
<EntitySet Name="adm_accesoxperfil" EntityType="Administracion.adm_accesoxperfil" />
<EntitySet Name="adm_accesoxusuario" EntityType="Administracion.adm_accesoxusuario" />
<EntitySet Name="adm_accionxnivelseguridadxusuario" EntityType="Administracion.adm_accionxnivelseguridadxusuario" />
<EntitySet Name="adm_alarmaxperiodopresupuesto" EntityType="Administracion.adm_alarmaxperiodopresupuesto" />
<EntitySet Name="adm_categoriapredefinidaxbanner" EntityType="Administracion.adm_categoriapredefinidaxbanner" />
<EntitySet Name="adm_configuraciondetallepresupuesto" EntityType="Administracion.adm_configuraciondetallepresupuesto" />
<EntitySet Name="adm_configuracionperiodopresupuesto" EntityType="Administracion.adm_configuracionperiodopresupuesto" />
<EntitySet Name="adm_confirmacionseguridadoperacion" EntityType="Administracion.adm_confirmacionseguridadoperacion" />
<EntitySet Name="adm_cuenta" EntityType="Base.adm_cuenta" />
<EntitySet Name="adm_cuentaxmetafinanciera" EntityType="Administracion.adm_cuentaxmetafinanciera" />
I edited the POCO entity generator template to read the CSDL files I've edited instead of reading the EDMX file on the project folder.
The code on the template looks like this:
string csdl = #"path\Administracion.csdl";
var ItemCollection = new EdmItemCollection(csdl);
When running the template I'm getting the following error:
Error 1 Running transformation: System.Data.MetadataException: Schema specified is not valid. Errors:
Administracion.csdl(3,4) : error 0160: No schema encountered with 'Base' namespace. Make sure the namespace is correct or the schema defining the namespace is specified.
Administracion.csdl(13,6) : error 0034: Unknown namespace or alias (Base).
What am I doing wrong? Is it because the CSDL files are in different folders? Where do I have to place them? Can the POCO entity generator template handle with importing namespaces on CSDL files?

The folders should be separated with '.' not '/'.
The correct format for the metadata is:
res:///DataLayer.myProject.myProject.csdl or
res:///DataLayer.myProject.myProject.ssdl or
res://*/DataLayer.myProject.myProject.msl

The problem behind the error was that I wasn't loading the other CSDL files in the EdmItemCollection. The solution was to load a String[] with the paths of the necessary CSDL files (including the ones with the imported namespaces) to the EdmItemCollection.
In code, it looks like this:
List<string> lstCsdlPaths = new List<string>();
lstCsdlPaths.Add(#"path\Base.csdl");
lstCsdlPaths.Add(#"path\Administracion.csdl");
var ItemCollection = new EdmItemCollection(lstCsdlPaths.ToArray());

Related

Deploying communities using package.xml

I am trying to retrieve Salesforce communities names 'XXX Community' from one org into VS Code and subsequently want to deploy it into another org.
However, when I use the sfdx force:source:retrieve -u DemoMaster -x ./package.xml command, for the below package.xml file, I get the following error:
Entity of type 'CustomSite' named 'XXX_Community_Test' cannot be found
Entity of type 'SiteDotCom' named 'XXX_Community_Test1' cannot be found
Only the network and network branding elements got retrieved.
The package.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>XXX Community</members>
<name>Network</name>
</types>
<types>
<members>XXX_Community_Test</members>
<name>CustomSite</name>
</types>
<types>
<members>XXX Community_Test1</members>
<name>SiteDotCom</name>
</types>
<types>
<members>cbXXX_Community</members>
<name>NetworkBranding</name>
</types>
<version>48.0</version>
</Package>
Any help appreciated!
D

What is wrong with my layer.xml from netbeans?

I try to create a new palette in netbeans 10, but the following 2 errors don't allow me to compile the project:
Document root element "folder", must match DOCTYPE root "JavaPalette". [3]
The markup in the document following the root element must be well-formed. [11]
My XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<folder name="JavaPalette">
<folder name="Items">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.javasourcefilepalette.Bundle"/>
<file name="Item.xml" url="resources/Item.xml">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.javasourcefilepalette.Bundle"/>
</file>
</folder>
</folder>
<filesystem/>
I have no clue what both error messages mean, but i did exactly what is said in the tutorial.
Online validation of the xml file also shows that error.
https://platform.netbeans.org/tutorials/nbm-palette-api2.html
I didn´t followed the tutorial, but as far as i can tell, your filesystem tag is not valid. If you take a look at the DTD you can see that the element filesystem isn´t declared as EMPTY (for more information you can read more about it here). So you have to provide a start and end tag. In your posted example you are only using <filesystem/> which isn´t allowed.
You have to change the xml as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
<folder name="JavaPalette">
<folder name="Items">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.javasourcefilepalette.Bundle"/>
<file name="Item.xml" url="resources/Item.xml">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.javasourcefilepalette.Bundle"/>
</file>
</folder>
</folder>
</filesystem>

How to include resources file in anjuta project

I'm trying to update a graphical project in vala, moving lot of code lines into an ui file.
I want to use template (available with glib-2.38 and GTK+3.8, something like that).
My project is managed with Anjuta and autoconf.
In the src directory there are
application.ui:
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<template class="SpiWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
<property name="default-width">600</property>
<property name="default-height">400</property>
<child>
<placeholder />
</child>
</template>
</interface>
resources.xml:
<?xml version="1.0" charset="UTF-8" ?>
<gresources>
<gresource prefix="/org/app/spi">
<file compressed="true" preprocess="xml-stripblanks">application.ui</file>
</gresource>
</gresources>
in src/Makefile.am I have append --gresources resources.xml to the spi_VALAFLAGS. And finally I declared The Gtk.ApplicationWindow like this
[GtkTemplate(ui = "/org/app/spi/application.ui")]
internal class SpiWindow : Gtk.ApplicationWindow {
// Constructor
public Window (Gtk.Application application) {
Object(application: application);
}
}
But when I compile and then run the application, there is the error message :
(spi:9749): Gtk-CRITICAL : Unable to load resource for composite template for type 'SpiWindow': The resource at '/org/app/spi/application.ui' does not exist
(spi:9749): Gtk-CRITICAL : gtk_widget_init_template: assertion 'template != NULL' failed
You still need to compile the resources and include them:
GLIB_COMPILE_RESOURCES=glib-compile-resources
resources.c: resources.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies resources.xml)
$(GLIB_COMPILE_RESOURCES) --target=$# --generate-source $<
and include resources.c as a source file in spi_SOURCES.

Querying svc log file with logParser

I have generated a xml trace for my program using the Enterprise Library TraceManager. It works great. Using the Microsoft Service Trace Viewer, I can see a separate trace per call.
I would love to query the file so I found Microsoft Logparser and was hopeful I could use that. Unfortunately, I cannot figure out the expected input format. Input of XML returns a error of more than one root node found for the document. None of the other format parse the correct number of line.
Has anyone had any success querying a SVCLog File
TraceManager traceManager
traceManager = EnterpriseLibraryContainer.Current.GetInstance<TraceManager>();
TraceLogEntry traceEntry = new TraceLogEntry();
using (this.traceManager.StartTrace("Tracing")){
traceEntry.Title = "Message";
traceEntry.Priority = Priority;
this.traceManager.LogWriter.Write(traceEntry);
}
The Tracing Category is hooked up to a XML trace listener:
< loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
< listeners>
< add name="XML Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.XmlTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.XmlTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
fileName="c:\A2ISOtrace.svclog" traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId" />
< /listeners>
< categorySources>
< add switchValue="All" name="Tracing">
< listeners>
< add name="XML Trace Listener" />
< /listeners>
< /add>
< /categorySources>
Log produces a number of rows like:
< E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System <EventID>1</EventID><Type>3</Type>. . . .
Since your SVCLog file is missing a root element you could embed it into a basic Xml document.
The Xml document
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE Root SYSTEM "Test.dtd">
<Root>
&svclog;
</Root>
The DTD document
<!ENTITY svclog SYSTEM "SVCLog.xml">
where you declare the ENTITY svclog importing your SVCLog file.
Now you should be able to parse the Xml input.

nant: expanding properties in a string

Summary:
How do I expand a property with value "download\${bulidmode}\project\setup.msi" to "download\Debug\project\setup.msi" if the property buildmode contained debug so I can use it as the file="" part of < copy >
Detail:
I have a bit of a requirement to be able to expand properties within a string in nant.
For example I have a target that is copying file A to B. A and B both come from a simple two field CSV file which I'm iterating through using
<foreach item="Line" in="filelist.csv" delim="," property="source.file,target.file">
<property name="sourcefile" value="${path::combine(source.dir,source)}" />
<property name="targetfile" value="${path::combine(download.dir,destination)}" />
<echo message="Copy ${sourcefile} to ${targetfile}" />
<copy file="${sourcefile" tofile="${destination}" />
</foreach>
and the filelist.csv will be
build\manifest.xml
solutiondirectory\setup-proj-directory\Release\setupproj.msi,ProductA\ProductA.msi
solutiondirectory\another-proj-dir\Release\setupproj.msi,ProductB\ProductB.msi
(The reason we split these out is that we write multi-tiered applications and deploy by MSI to each tier - so one product has multiple msi's all built with the same version numbers)
Anyway - I want to change this to that I no longer have "Release" in the filelist.csv file but something like ${build.mode}. I would wrap the above code with a
<foreach item="String" in="Release,Debug" delim="," property="build.mode">
....as above
</foreach>
and the property embedded within the string in the file gets expanded.
I've been beating my head against a brick wall for a few hours, but just can't figure it out.
Thanks
It is possible with a custom function :
<?xml version="1.0"?>
<project>
<script language="C#" prefix="vbfox" >
<code>
<![CDATA[
[Function("expand")]
public string ExpandString(string str)
{
return Project.Properties.ExpandProperties(str, Location.UnknownLocation);
}
]]>
</code>
</script>
<property name="hello" value="{path::combine('_hello_', '_world_')}" />
<property name="hello" value="${'$' + hello}" />
<echo message="${hello}" />
<echo message="${vbfox::expand(hello)}" />
</project>