map fields directly

14 views
Skip to first unread message

schlachtzeuger

unread,
Feb 24, 2011, 10:24:34 AM2/24/11
to ConfORM
Hi,

i'd like to map fields directly with conform. eg

public class MyClass
{
private string _field0ToMap;
private string _field1ToMap;
.
.
.
}

Is this possible? How?

Regards
Andy

Fabio Maulo

unread,
Feb 24, 2011, 10:35:41 AM2/24/11
to codec...@googlegroups.com
what you mean?
With those "...." my answer could be:
Yes, for sure, if you do ... and then ... you have the result you are looking for.
--
Fabio Maulo

schlachtzeuger

unread,
Feb 26, 2011, 7:46:51 AM2/26/11
to ConfORM
you're right, i'll have to explain better:

given this class:

public class Entity
{
private Guid _id;
private string _name;

/*nh ctor*/ protected Entity() {}

public Entity(Guid id, string name)
{
_id = id;
_name = name;
}
}

i'd like to use conform to get this mapping:

<?xml version="1.0"?>
<hibernate-mapping
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:nhibernate-mapping-2.2"
namespace="Ebe.Tests"
assembly="Ebe.Tests">

<class name="Entity">
<id name="_id"
unsaved-value="00000000-0000-0000-0000-000000000000"
access="field">
<generator class="assigned" />
</id>
<property name="_name" access="field" />
</class>

</hibernate-mapping>


thx

On 24 Feb., 16:35, Fabio Maulo <fabioma...@gmail.com> wrote:
> what you mean?
> With those "...." my answer could be:
> Yes, for sure, if you do ... and then ... you have the result you are
> looking for.
>
> On Thu, Feb 24, 2011 at 12:24 PM, schlachtzeuger
> <schlachtzeu...@gmail.com>wrote:
>
>
>
>
>
> > Hi,
>
> > i'd like to map fields directly with conform. eg
>
> > public class MyClass
> > {
> > private string _field0ToMap;
> > private string _field1ToMap;
> > .
> > .
> > .
> > }
>
> > Is this possible? How?
>
> > Regards
> > Andy
>
> --
> Fabio Maulo- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Diego Mijelshon

unread,
Feb 26, 2011, 10:51:48 AM2/26/11
to codec...@googlegroups.com, schlachtzeuger
For the Id:

    orm.Patterns.Poids.Add(mi => mi.Name == "_id");

Not sure about the field.

In any case: that's a terrible domain design. Why do you have persistent fields that aren't exposed in any way (except in the constructor!)? Why do you have a field for the Id if you're not exposing it?
 
    Diego

schlachtzeuger

unread,
Feb 28, 2011, 5:43:41 AM2/28/11
to ConfORM
Hi

so is it possible to do the mapping explained in the post (on 26. Feb
13:46) ?

... i didn't ask how to do good domain design, i'm just evaluating
conform on a technical level ...

regards


On 26 Feb., 16:51, Diego Mijelshon <di...@mijelshon.com.ar> wrote:
> For the Id:
>
>     orm.Patterns.Poids.Add(mi => mi.Name == "_id");
>
> Not sure about the field.
>
> In any case: that's a terrible domain design. Why do you have persistent
> fields that aren't exposed in any way (except in the constructor!)? Why do
> you have a field for the Id if you're not exposing it?
>
>     Diego
>
> > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -

Fabio Maulo

unread,
Feb 28, 2011, 6:59:49 AM2/28/11
to codec...@googlegroups.com
well... 
what exactly mean for you "field access" ?
have you only field without properties ?
do you need the field only for the POID ?

"Good design" is not a minor matter here... ConfORM does not give support to composite-id for some reason ;)

Please send a couple of classes mimic your domain and I will implements the UsageExample (I would spend time solving a well known problem and not inventing a problem).
Thanks.
--
Fabio Maulo

Diego Mijelshon

unread,
Feb 28, 2011, 7:41:27 AM2/28/11
to codec...@googlegroups.com, schlachtzeuger
OK, on a technical level, ConfORM works really well with most _sane_ designs.
If you want to hack a mapping around an arbitrarily weird domain, use XML mappings instead.
 
    Diego

Fabio Maulo

unread,
Feb 28, 2011, 10:37:13 PM2/28/11
to codec...@googlegroups.com
please send the domain to use as example.
Thanks.

--
Fabio Maulo

schlachtzeuger

unread,
Mar 1, 2011, 5:26:32 AM3/1/11
to ConfORM
by now i have no domain in c#, i'll send it, if i have something, but
this will take some time, i think until sunday or so

thx

On 1 Mrz., 04:37, Fabio Maulo <fabioma...@gmail.com> wrote:
> please send the domain to use as example.
> Thanks.
>
> --
> Fabio Maulo
>

Fabio Maulo

unread,
Mar 16, 2011, 12:32:46 PM3/16/11
to codec...@googlegroups.com
It is clear to me that the case is: "or so"
--
Fabio Maulo

Reply all
Reply to author
Forward
0 new messages