[XmlIgnore] in an entity property doesn't work

Sep 30, 2009 at 8:32 AM
Edited Sep 30, 2009 at 8:55 AM

Hi,

I need to declare an unmapped property in one of my entities. I have used [XmlIgnore] in get/set declaration

[Serializable]
public class Rol
{

[XmlIgnore]
public string RESX_MenuText
{
get { return _RESX_MenuText; }
set { _RESX_MenuText = value; }
 }

}

but when serializing the object (r is an intance of this class) I'm getting an exception at CommitTransaction() method:

base.Context.BeginTransaction();
base.Context.Serialize(r);

base.Context.CommitTransaction(); --> Cannot find the attribute 'RESX_MenuText' of the entity 'name:Logica:Usuarios:Rol' in your mapping file.

Yours,

Josep Balague

Sep 30, 2009 at 8:44 AM

Should be possible something like this

<Attribute name="RESX_MenuText" ignore="True"/>

in next version? If true let me know how update your code with this change.

Yours,

Josep Balague

Coordinator
Sep 30, 2009 at 9:20 AM

Hello Josep,

 

From what you have said, you are using a mapping file, thus you use the SqlMapperEngine, right ? If you want to ignore an Attribute, it is already possible. To do so, you need to create a metadata file which would contain only the element you want to "override". It would look like something like that.

<Entity type="name:Logica:Usuarios:Rol">

<Attribute name="REsX_MenuText" ignore="true" />

</Entity>

For more information, you should have a look at the EUSSdocumentation where you should be able to find the correct syntax for the whole metadata xml file.

 

Thanks for using EUSS.

Nicolas Penin

Oct 1, 2009 at 7:20 AM
Edited Oct 1, 2009 at 8:05 AM

Hi Nicolas,

thanks for your quick answer. I'm not using SqlMapperEngine because documentation I got, covers mapping file. About tags document says:

XML tag definitions

The available XML tags are described below.

Tag/Attribute

 

Description

<Model>

required

Encapsulates the file and references the current protocol standard. Encapsulates a set of Entity declarations.

<Entity>

required

Declares an Entity (a class). Encapsulates a set of Attribute and Reference declarations.

type

required

Full type of the entity to declare.

ignore

optional

If true, the entity will be removed from discovered entities.

<Attribute>

optional

Declares an Attribute (property) in an Entity.

name

required

Name of the declared Attribute.

type

required

Type of the Attribute. It must be a valid type in the .NET CLI (Common Language Infrastructure).

inherit

optional

Full name of the base for this type.

ignore

optional

If true, the attribute will be ignored during serialization.

implement

optional

Comma separated list of all interfaces the type implements. It should contain the whole inheritance tree.

<Reference>

optional

Declares a relationship between two classes. Declares a property. Encapsulates a Parent and a Child declarations.

name

required

Name of the declared Reference.

type

required

Type of the reference.

Allowed values:

composition, aggregation

fromMany

optional

Whether the child Entity of the reference can be referenced by several other ones. Allowed values:

0, 1, false, true. By default it is “true”.

toMany

optional

Whether the parent Entity of the reference can reference several other ones. Allowed values:

0, 1, false, true.

composition

optional

Type of the reference.

Allowed values:

true, false. By default it is “false”.

ignore

optional

If true, the reference will be ignored during serialization.

In blue I guess is your suggestion: <Attribute name="RESX_MenuText" ignore="true" />

After checking your comment, my xml file contains these lines. Exception is still being raised at SqlMapperCommandProcessor.cs at method public void Process(CompoundCreateCommand c) at line cmd.ExecuteNonQuery();

<Entity type="nqme:Logica:Usuarios:Rol" table="ROLES">
  <Id field="ROL"><Generator name="business"></Generator></Id>
  <Attribute name="Codigo" field="ROL" db-type="String" size="20" not-null="true" />
  <Attribute name="RESX_MenuID" field="IDRECURSO" db-type="String" size="15" not-null="false" />
  <Attribute name="RESX_MenuText" ignore="true" />
</Entity>

I have checked to set null this unmapped property: Exception is raised again. This is the final code:

Rol r = new Rol();
r.Codigo = "1";
r.RESX_MenuID = "ABC";
r.RESX_MenuText = null;
_oc.Context.BeginTransaction();
_oc.Context.Serialize(r);
_oc.Context.CommitTransaction();

And this is the query Evaluant is sending to SQL Server:

"INSERT INTO [ROLES]  ([ROL] , [IDRECURSO] , [RESX_MenuText]  ) VALUES ( @ROL ,  @IDRECURSO ,  @RESX_MenuText  ) "

Can you suggest something else please?

Yours,

Josep Balague

Coordinator
Oct 1, 2009 at 7:38 AM

Hi Josep,

If the exception is raised in the SqlMapperCommandProcessor, you are using the SqlMapperEngine. I think you misunderstood me. There are many ways to give information to euss. The first one is to give an assembly from which we try to find all the information needed. If this is not enough, you can give a metadata file (different from the mapping file). So for your example, you would have an XML file (metadata.xml for example) like this :

<?xml version="1.0" encoding="utf-8" ?>
<?evaluant-application progid="EUSS.MetaData"?>
<Model xmlns="http://euss.evaluant.com/schemas/MetaDataModel.xsd">

  <Entity type="name:Logica:Usuarios:Rol">
    <Attribute name="RESX_MenuText" ignore="true" />
  </Entity>
</Model>

You still need  your mapping file where the attribute REX_MenuText is not declared anymore.

Then you need your engine to be configured to something like this :

 

      <engine name="myName" factory="Evaluant.Uss.SqlMapper.SqlMapperProvider" connectionStringName="mashupConnectionString">
        <add name="Driver" value="Evaluant.Uss.SqlMapper.MsSqlDriver"/>
        <add name="Dialect" value="Evaluant.Uss.SqlMapper.MsSqlDialect"/>
        <add name="MappingFilename" value="~/mapping.xml"/>
        <metadata>
          <add type="assembly" value="name:Logica:Usuarios"/>
          <add type="metadata" value="~/metadata.xml"/>
        </metadata>
      </engine>

 

Regards,

Nicolas Penin

 

 

 

 

Oct 1, 2009 at 10:31 AM
Edited Oct 1, 2009 at 12:54 PM

Hi Nicolas,

I apologize for my understood. I have changed Map.config and created Metadata.xml

Map.config

<?xml version="1.0" encoding="utf-8"?>

<PersistenceEngines xmlns="http://euss.evaluant.com/schemas/EngineConfiguration.xsd"

DefaultEngine="SQL">

  <PersistenceEngine Name="SQL" Factory="Evaluant.Uss.SqlMapper.SqlMapperProvider">

    <ConnectionString>

      Data Source=localhost;Initial Catalog=…;Password=…;User ID=…;

    </ConnectionString>

    <Driver>Evaluant.Uss.SqlMapper.MsSqlDriver</Driver>

    <Dialect>Evaluant.Uss.SqlMapper.MsSqlDialect</Dialect>

    <MappingFileName>~/DigitekLogic.eum.xml</MappingFileName>

    <metadata>

      <add type="assembly" value="DigitekLogic"/> (this is a DLL!!!)

      <add type="metadata" value="~/metadata.xml"/>

    </metadata>

  </PersistenceEngine>

</PersistenceEngines> 

Metadata.xml

<?xml version="1.0" encoding="utf-8" ?>

<?evaluant-application progid="EUSS.MetaData"?>

<Model xmlns="http://euss.evaluant.com/schemas/MetaDataModel.xsd">

 

  <Entity type="Evalos:Logica:Usuarios:Rol">

    <Attribute name="RESX_MenuText" ignore="true" />

  </Entity>

</Model>

 

Now  I’m getting crazy because ObjectService os = new ObjectService(strFileName); can’t open Map.config file, raising this exception: Attribute "Type" missing for <Metadata>.  Before your suggestion Map.config had

<Metadata Type="assembly">DigitekLogic</Metadata>

Instead of

    <metadata>

      <add type="assembly" value="DigitekLogic"/>

      <add type="metadata" value="~/metadata.xml"/>

    </metadata>

 

And load was working fine. Please can you suggest me something else for solving both issues this new exception and attribute ignoring issue?

Yours,

Josep Balague

 

<!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Version>12.00</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:HyphenationZone>21</w:HyphenationZone> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /> <w:LidThemeOther>ES</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:SplitPgBreakAndParaMark /> <w:DontVertAlignCellWithSp /> <w:DontBreakConstrainedForcedTables /> <w:DontVertAlignInTxbx /> <w:Word11KerningPairs /> <w:CachedColBalance /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math" /> <m:brkBin m:val="before" /> <m:brkBinSub m:val="--" /> <m:smallFrac m:val="off" /> <m:dispDef /> <m:lMargin m:val="0" /> <m:rMargin m:val="0" /> <m:defJc m:val="centerGroup" /> <m:wrapIndent m:val="1440" /> <m:intLim m:val="subSup" /> <m:naryLim m:val="undOvr" /> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true" DefSemiHidden="true" DefQFormat="false" DefPriority="99" LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w:LsdException Locked="false" Priority="9" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w:LsdException Locked="false" Priority="39" Name="toc 1" /> <w:LsdException Locked="false" Priority="39" Name="toc 2" /> <w:LsdException Locked="false" Priority="39" Name="toc 3" /> <w:LsdException Locked="false" Priority="39" Name="toc 4" /> <w:LsdException Locked="false" Priority="39" Name="toc 5" /> <w:LsdException Locked="false" Priority="39" Name="toc 6" /> <w:LsdException Locked="false" Priority="39" Name="toc 7" /> <w:LsdException Locked="false" Priority="39" Name="toc 8" /> <w:LsdException Locked="false" Priority="39" Name="toc 9" /> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w:LsdException Locked="false" Priority="10" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w:LsdException Locked="false" Priority="11" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w:LsdException Locked="false" Priority="22" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w:LsdException Locked="false" Priority="20" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w:LsdException Locked="false" Priority="59" SemiHidden="false" UnhideWhenUsed="false" Name="Table Grid" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w:LsdException Locked="false" Priority="1" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 1" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w:LsdException Locked="false" Priority="34" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w:LsdException Locked="false" Priority="29" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w:LsdException Locked="false" Priority="30" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 2" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 3" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 4" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 5" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 6" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /> <w:LsdException Locked="false" Priority="19" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w:LsdException Locked="false" Priority="21" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w:LsdException Locked="false" Priority="31" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w:LsdException Locked="false" Priority="32" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w:LsdException Locked="false" Priority="33" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w:LsdException Locked="false" Priority="37" Name="Bibliography" /> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w:LatentStyles> </xml><![endif]--><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-fareast-language:EN-US;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:595.3pt 841.9pt; margin:70.85pt 3.0cm 70.85pt 3.0cm; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} --><!--[if gte mso 10]> <mce:style><! /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Tabla normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} --> <!--[endif]-->

Hi Nicolas,

I apologize for my understood. I have changed Map.config and created Metadata.xml

Map.config

<?xml version="1.0" encoding="utf-8"?>

<PersistenceEngines xmlns="http://euss.evaluant.com/schemas/EngineConfiguration.xsd"

DefaultEngine="SQL">

  <PersistenceEngine Name="SQL" Factory="Evaluant.Uss.SqlMapper.SqlMapperProvider">

    <ConnectionString>

      Data Source=localhost;Initial Catalog=…;Password=…;User ID=…;

    </ConnectionString>

    <Driver>Evaluant.Uss.SqlMapper.MsSqlDriver</Driver>

    <Dialect>Evaluant.Uss.SqlMapper.MsSqlDialect</Dialect>

    <MappingFileName>~/DigitekLogic.eum.xml</MappingFileName>

    <metadata>

      <add type="assembly" value="DigitekLogic"/> (this is a DLL!!!)

      <add type="metadata" value="~/metadata.xml"/>

    </metadata>

  </PersistenceEngine>

</PersistenceEngines> 

Metadata.xml

<?xml version="1.0" encoding="utf-8" ?>

<?evaluant-application progid="EUSS.MetaData"?>

<Model xmlns="http://euss.evaluant.com/schemas/MetaDataModel.xsd">

 

  <Entity type="Evalos:Logica:Usuarios:Rol">

    <Attribute name="RESX_MenuText" ignore="true" />

  </Entity>

</Model> 

 

Now  I’m getting crazy because ObjectService os = new ObjectService(strFileName); can’t open Map.config file, raising this exception: Attribute "Type" missing for <Metadata>.  Before your suggestion Map.config had

<Metadata Type="assembly">DigitekLogic</Metadata> 

Instead of

    <metadata>

      <add type="assembly" value="DigitekLogic"/>

      <add type="metadata" value="~/metadata.xml"/>

    </metadata>

 

And it worked fine. Please can you suggest me something else?

Yours,

Josep Balague

Coordinator
Oct 1, 2009 at 12:19 PM

Hi Josep,

I assumed you were using you app.config file (or web.config for ASP.NET web application), I was wrong. Here is how you can do with the old configuration file :

 

<?xml version="1.0" encoding="utf-8"?>
<PersistenceEngines xmlns="http://euss.evaluant.com/schemas/EngineConfiguration.xsd"DefaultEngine="SQL">
  <PersistenceEngine Name="SQL" Factory="Evaluant.Uss.SqlMapper.SqlMapperProvider">
    <ConnectionString>
      Data Source=localhost;Initial Catalog=…;Password=…;User ID=…;
    </ConnectionString>
    <Driver>Evaluant.Uss.SqlMapper.MsSqlDriver</Driver>
    <Dialect>Evaluant.Uss.SqlMapper.MsSqlDialect</Dialect>
    <MappingFileName>~/DigitekLogic.eum.xml</MappingFileName>
    <Metadata Type="assembly">DigitekLogic</Metadata>
    <Metadata Type="metadata">~/metadata.xml</Metadata>
  </PersistenceEngine>
</PersistenceEngines> 

Regards,

Nicolas Penin

 

Oct 1, 2009 at 1:21 PM

Hi Nicolas,

Don’t worry. I was not much explicit in my last message. Thanks for your help. I'm using ASP.NET.

Now my Map.config is this: 

Map.config

<?xml version="1.0" encoding="utf-8"?>

<PersistenceEngines xmlns="http://euss.evaluant.com/schemas/EngineConfiguration.xsd"

DefaultEngine="SQL">

  <PersistenceEngine Name="SQL" Factory="Evaluant.Uss.SqlMapper.SqlMapperProvider">

    <ConnectionString>

      Data Source=localhost;Initial Catalog=…;Password=…;User ID=…;

    </ConnectionString>

    <Driver>Evaluant.Uss.SqlMapper.MsSqlDriver</Driver>

    <Dialect>Evaluant.Uss.SqlMapper.MsSqlDialect</Dialect>

    <MappingFileName>~/DigitekLogic.eum.xml</MappingFileName>

    <Metadata Type="assembly">DigitekLogic</Metadata>

    <Metadata Type="metadata">~/metadata.xml</Metadata>

  </PersistenceEngine>

</PersistenceEngines>

 

Now I’m getting this exception:

[NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.] (In English: “reference to an object not set to an instance of an object”) at

ObjectService os = new ObjectService(strFileName);

 Other xml files haven’t been changed.

This is the stack trace:

[NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.]

   Evaluant.Uss.MetaDataFactory.FromMetaDataFile(XmlReader inStream) +1604

   Evaluant.Uss.MetaDataFactory.FromMetaDataFile(String filename) +100

   Evaluant.Uss.XmlConfigLoader.CreateEngine(XmlNode nodeEngine, String basePath) +2839

   Evaluant.Uss.XmlConfigLoader.LoadXmlConfig(Stream stream, String engineName, String basePath) +570

   Evaluant.Uss.XmlConfigLoader.LoadXmlConfig(String filename, String engineName) +272

   Evaluant.Uss.XmlConfigLoader.LoadXmlConfig(String filename) +33

   Evaluant.Uss.ObjectContext.ObjectService..ctor(String filename) +40

 

Yours,

Josep Balague

Coordinator
Oct 1, 2009 at 1:31 PM

Hi Josep,

 

I forgot one point in the metadata file : you have to specify the attribute name (which you already did), but you also need to specify the type. I guess you RESX_MenuText is a string, so you should have this in you metadata file :

 

<?xml version="1.0" encoding="utf-8" ?>
<?evaluant-application progid="EUSS.MetaData"?>
<Model xmlns="http://euss.evaluant.com/schemas/MetaDataModel.xsd">

  <Entity type="name:Logica:Usuarios:Rol">
    <Attribute name="RESX_MenuText" ignore="true" type="String" />
  </Entity>
</Model>

However, this exception should be caught to be more understandable... Thanks for you feed back.

 

Regards,

Nicolas Penin

 

Oct 1, 2009 at 2:25 PM

Hi Nicolas,

You wellcome.

After your suggestion, ignore attribute .. is working fine!!!!

Thanks a million for your valuable help.

See you soon in a new post.

Yours sincerely,

Josep Balague

Oct 21, 2009 at 7:36 AM

Hi again Nicolas,

after some tests with this 'ignore' solution I didn't mananged to apply ignore tag in types others than string and int32: Object (is my test)

meta.xml

<Entity type="name:Logica:Anomalias:AnomaliasConfiguracion">
    <Attribute name="Usuario" ignore="true" type="Object"/>
    <Attribute name="CorreoElectronico" ignore="true" type="Object"/>
    <Attribute name="PersonalParaCalculo" ignore="true" type="Object"/>
  </Entity>

Usuario of type Usuario, is mapped in eum.xml (although only is necessary for one process no for db storing)

CorreoElectronico of type List<DictionaryEntry>is not a mapped class

PersonalParaCalculo of type List<T>, is not a mapped class

but when serializing the object I'm getting an exception at CommitTransaction() method:

public static void SaveInstance_Configuracion(
            EussContext oc,
            AnomaliasConfiguracion item)
        {
            oc.Context.BeginTransaction();
            oc.Context.Serialize(item); --> Cannot find the attribute 'CorreoElectronico' of the entity 'name:Logica:Anomalias:AnomaliasConfiguracio' in your mapping file.
            oc.Context.CommitTransaction();
        }

Actually, I don't have defined neither CorreoElectronico nor Usuario nor PersonalParaCalculo attributes in eum.xml file because I'm apply the same reasoning of string type: meta.xml

Please can you help me?

Yours,

Josep Balague

 

Coordinator
Oct 21, 2009 at 9:44 AM

Hi Josep,

If Usario is mapped, you should declare it as a reference, not as an attribute.

You need to specify the true type as it is declared in you classes. To do so, you should write instead of Object the string representation of the List<DictionaryEntry>. From my memory, I would say something like "System.Collections.Generic.List`1[[System.Collections.DictionaryEntry]]". Not pretty sure about the string representation I have wrote. To get it, you can simply call ToString on an instance of such a list.

 

Regards,

Nicolas Penin