IEcoList<ObjectA>

1 view
Skip to first unread message

Johannes Klos at

unread,
Aug 6, 2008, 7:17:30 AM8/6/08
to
Hi,

I would like to do the following:

if (objectB.objectA_List.Contains<objectA>(anyobjectAInstance))
do something

If I run the code I get the following error:
Invalid type encountered while transforming data using
Eco.Persistence.Default.StringAsVarChar. Expected System.String but the
value (1b5dfb4e-607f-44c8-917d-d10dd86b3e76) was System.Guid. Check your
settings in PersistenceMapper.SqlDatabaseConfig.PersistenceMappers

I am using System.Guids as Identifiers.

What am I doing wrong? How can I check if objectB.obecjtA_List contains an
objectA?
It is a many-to-many association.

Johannes


Dmitriy Nagirnyak

unread,
Aug 6, 2008, 8:18:01 AM8/6/08
to
Hello Johannes,

> What am I doing wrong?

Callstack please?

> How can I check if objectB.obecjtA_List
> contains an objectA?
>

It seems you wrote it correctly.

company.Employees.Contains(employee)
emloyee.Companies.Contains(company)

Dmitriy.


Johannes Klos at

unread,
Aug 6, 2008, 10:15:35 AM8/6/08
to
Hi,

that is the only error I get and the debugger ends ub in sime assembler...
I though so too, that company.Employees.Contains(employee) should be
correct, but it throws the same error as the generic version of it...

Johannes


"Dmitriy Nagirnyak" <nagir_argocomputing_com_au> schrieb im Newsbeitrag
news:4efaf8be1b7a8...@newsgroups.borland.com...

Dmitriy Nagirnyak

unread,
Aug 6, 2008, 8:31:23 PM8/6/08
to
> but it throws the same error as the generic version of it...
>
Callstack?


Johannes Klos at

unread,
Aug 7, 2008, 12:12:13 AM8/7/08
to
Do you mean this?

Eco.Persistence.dll!Eco.Persistence.Default.AbstractSingleColumnAttribute.ThrowTypeError(object
value = {1b5dfb4e-607f-44c8-917d-d10dd86b3e76}, System.Type t = {Name =
"String" FullName = "System.String"}) Zeile 279 + 0x77 Bytes C#

Eco.Persistence.dll!Eco.Persistence.Default.AbstractSingleColumnAttribute.EnsureType(object
value = {1b5dfb4e-607f-44c8-917d-d10dd86b3e76}, System.Type t = {Name =
"String" FullName = "System.String"}) Zeile 294 + 0xe Bytes C#

Eco.Persistence.dll!Eco.Persistence.Default.StringAsVarChar.ColumnToValue(object
columnValue = {1b5dfb4e-607f-44c8-917d-d10dd86b3e76}) Zeile 697 + 0x21 Bytes
C#

[Externer Code]
Eco.Persistence.dll!Eco.Persistence.PersistenceMapperDb.PersistenceMapperAdapter.Eco.Persistence.IPersistenceMapper.Fetch(Eco.DataRepresentation.ObjectIdList
idList = {Eco.DataRepresentation.ObjectIdList}, out
Eco.DataRepresentation.Datablock datablock =
{Eco.DataRepresentation.Datablock}, int[] memberIdList = {int[1]},
Eco.Framework.FetchStrategy fetchStrategy = FetchObjects) Zeile 651 + 0x21
Bytes C#

StackTrace:

bei
Eco.Persistence.Default.AbstractSingleColumnAttribute.ThrowTypeError(Object
value, Type t) in
e:\dev\e4vs\source\Public.CLR\Persistence\DefaultAttributeMappers.cs:Zeile
279.
bei
Eco.Persistence.Default.AbstractSingleColumnAttribute.EnsureType(Object
value, Type t) in
e:\dev\e4vs\source\Public.CLR\Persistence\DefaultAttributeMappers.cs:Zeile
294.
bei Eco.Persistence.Default.StringAsVarChar.ColumnToValue(Object
columnValue) in
e:\dev\e4vs\source\Public.CLR\Persistence\DefaultAttributeMappers.cs:Zeile
697.
bei
Eco.Internal.TBoldGenericSingleColumnAttributeMapper.ValueFromFields(ObjectContents
ObjContents, TInexactIdList RequiresExactification, IField[] Fields) in
source\PMapper\Core\BoldPMappers.pas:Zeile 4918.

"Dmitriy Nagirnyak" <nagir_argocomputing_com_au> schrieb im Newsbeitrag

news:4efaf8be1bb68...@newsgroups.borland.com...

Dmitriy Nagirnyak

unread,
Aug 7, 2008, 4:22:51 AM8/7/08
to
Hello Johannes,

It seems you have some problem with attributes configuration.
So it's hard to tell something what's wrong not seeing your configuration,
model details etc.

It would be perfect if you could prepare a test case that reproduces it.

I've just done it and everything is working as expected. (Using MSSQL persitence
mapper provider, default mapping, Employee-*--*-Company).
[TestMethod]
public void PerformSearchOnManyToMany_DoesntFail() {
var c = new Company(Repository);
var e1 = new Employee(Repository);
var e2 = new Employee(Repository);
c.Employees.Add(e1);
c.Employees.Add(e2);
Repository.UpdateDatabase();

Assert.IsTrue(c.Employees.Contains(e1));
Assert.IsTrue(c.Employees.Contains(e2));
Assert.IsTrue(e1.Companies.Contains(c));
Assert.IsTrue(e2.Companies.Contains(c));
}

So please create a test case to reproduce the problem.

Cheers.


Johannes Klos at

unread,
Aug 7, 2008, 9:48:59 AM8/7/08
to
Hi!

I did a test-case:

Interessting is that the test-case does work in the main-form with the
ecospace from the mainform.
If I transfer the same!! code to the child-form and you that ecospace in
there I get the error massge. So the model is ok, I would guess.

I am doing the following to initilaize the ecospace in the childform:

ecoSpace = new CBMEcoSpace();
ecoSpace.Active = true;

So that is nothing special, I think.

Can someone help me?

Thanks,
Johannes

"Dmitriy Nagirnyak" <nagir_argocomputing_com_au> schrieb im Newsbeitrag

news:4efaf8be1bd28...@newsgroups.borland.com...

Johannes Klos at

unread,
Aug 7, 2008, 12:03:58 PM8/7/08
to
Ok I have the solution and I have a small project which demonstrates that
behavior. I am not sure if it is an error....

I created two classes:
- employee: one attribute: name1
- company: one attribute: name

If I creat an association with the two ends called "employees" respectivly
"companys" everthings works fine.

But in my system I had an association named the same name like an attribute
in a class where it is showing to. So in the upper case I would rename
"companys" to "name".
If you do that you will get the error....
I can send the test-project if someone wants to have a look.

Is it a bug? Is that the wanted bahviour? If so maybe eco should warn about
that fact.

Johannes

"Johannes Klos" <johannes.klos(at)web.de> schrieb im Newsbeitrag
news:489afd54$1...@newsgroups.borland.com...

Reply all
Reply to author
Forward
0 new messages