Re: Ria services, Data annotations

2012-03-05 Thread Jordan Knight
'Tis the kind of problem that pragmatism solves without a second's thought
:)

On Mon, Mar 5, 2012 at 10:03 PM, Craig Richards <
craiganthonyricha...@gmail.com> wrote:

> Sounds good to me, sometimes we fight and resist too much. 😜
>
> Sent from my iPhone
>
> On 05/03/2012, at 13:27, David Burela  wrote:
>
> As much as I was trying to avoid it, I ended up just setting dummy values
> on the client side, which the domain service overwrites.
>
> On 2 March 2012 12:37, Stephen Price  wrote:
>
>> Try  [DisplayFormat(ConvertEmptyStringToNull = false)]
>>
>> This post isn't exactly your scenario but it could be related to the
>> strings you have (nvarchar) and they might be defaulting to null?
>>
>> http://stackoverflow.com/questions/3129080/server-side-validation-of-a-required-string-property-in-mvc2-entity-framework-4
>>
>>
>> worth a try anyway :)
>>
>> the other way is to just set it on the client and then ignore what the
>> client provides.
>>
>>
>> On Fri, Mar 2, 2012 at 9:18 AM, David Burela 
>> wrote:
>> >
>> > I've got a weird problem.
>> >
>> > There are tables in a database with these additional columns
>> "CreatedById", "ModifiedById". (They are nvarchar, not null)
>> > There is then an entity framework model for this (again, strings, not
>> null).
>> > RIA services is used to share the entities with the client.
>> >
>> > The problem is in Silverlight side. If I create a new Product class,
>> display it in a Dataform to allow the user to edit price, etc. I can't
>> submit product to the domain service because validation fails "CreatedById
>> can not be null". It makes no sense to set those values on the client side
>> as they could spoof those files. I have logic on the domain service side
>> that looks at the current authenticated user and automatically sets those
>> fields.
>> >
>> > But I can't submit them because validation keeps failing on those 2
>> fields.
>> > Is there a [NotRequired] property I could put on the domain service
>> metadata file?
>> > -David Burela
>> >
>> > ___
>> > ozsilverlight mailing list
>> > ozsilverlight@ozsilverlight.com
>> > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>> >
>>
>> ___
>> ozsilverlight mailing list
>> ozsilverlight@ozsilverlight.com
>> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>>
>>
> ___
> ozsilverlight mailing list
> ozsilverlight@ozsilverlight.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>
>
> ___
> ozsilverlight mailing list
> ozsilverlight@ozsilverlight.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>
>
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Ria services, Data annotations

2012-03-05 Thread Craig Richards
Sounds good to me, sometimes we fight and resist too much. 😜

Sent from my iPhone

On 05/03/2012, at 13:27, David Burela  wrote:

> As much as I was trying to avoid it, I ended up just setting dummy values on 
> the client side, which the domain service overwrites.
> 
> On 2 March 2012 12:37, Stephen Price  wrote:
> Try  [DisplayFormat(ConvertEmptyStringToNull = false)] 
> 
> This post isn't exactly your scenario but it could be related to the strings 
> you have (nvarchar) and they might be defaulting to null?
> http://stackoverflow.com/questions/3129080/server-side-validation-of-a-required-string-property-in-mvc2-entity-framework-4
>  
> 
> worth a try anyway :)
> 
> the other way is to just set it on the client and then ignore what the client 
> provides. 
> 
> 
> On Fri, Mar 2, 2012 at 9:18 AM, David Burela  wrote:
> >
> > I've got a weird problem.
> >
> > There are tables in a database with these additional columns "CreatedById", 
> > "ModifiedById". (They are nvarchar, not null)
> > There is then an entity framework model for this (again, strings, not null).
> > RIA services is used to share the entities with the client.
> >
> > The problem is in Silverlight side. If I create a new Product class, 
> > display it in a Dataform to allow the user to edit price, etc. I can't 
> > submit product to the domain service because validation fails "CreatedById 
> > can not be null". It makes no sense to set those values on the client side 
> > as they could spoof those files. I have logic on the domain service side 
> > that looks at the current authenticated user and automatically sets those 
> > fields.
> >
> > But I can't submit them because validation keeps failing on those 2 fields.
> > Is there a [NotRequired] property I could put on the domain service 
> > metadata file?
> > -David Burela
> >
> > ___
> > ozsilverlight mailing list
> > ozsilverlight@ozsilverlight.com
> > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
> >
> 
> ___
> ozsilverlight mailing list
> ozsilverlight@ozsilverlight.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
> 
> 
> ___
> ozsilverlight mailing list
> ozsilverlight@ozsilverlight.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Ria services, Data annotations

2012-03-04 Thread David Burela
As much as I was trying to avoid it, I ended up just setting dummy values
on the client side, which the domain service overwrites.

On 2 March 2012 12:37, Stephen Price  wrote:

> Try  [DisplayFormat(ConvertEmptyStringToNull = false)]
>
> This post isn't exactly your scenario but it could be related to the
> strings you have (nvarchar) and they might be defaulting to null?
>
> http://stackoverflow.com/questions/3129080/server-side-validation-of-a-required-string-property-in-mvc2-entity-framework-4
>
>
> worth a try anyway :)
>
> the other way is to just set it on the client and then ignore what the
> client provides.
>
>
> On Fri, Mar 2, 2012 at 9:18 AM, David Burela 
> wrote:
> >
> > I've got a weird problem.
> >
> > There are tables in a database with these additional columns
> "CreatedById", "ModifiedById". (They are nvarchar, not null)
> > There is then an entity framework model for this (again, strings, not
> null).
> > RIA services is used to share the entities with the client.
> >
> > The problem is in Silverlight side. If I create a new Product class,
> display it in a Dataform to allow the user to edit price, etc. I can't
> submit product to the domain service because validation fails "CreatedById
> can not be null". It makes no sense to set those values on the client side
> as they could spoof those files. I have logic on the domain service side
> that looks at the current authenticated user and automatically sets those
> fields.
> >
> > But I can't submit them because validation keeps failing on those 2
> fields.
> > Is there a [NotRequired] property I could put on the domain service
> metadata file?
> > -David Burela
> >
> > ___
> > ozsilverlight mailing list
> > ozsilverlight@ozsilverlight.com
> > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
> >
>
> ___
> ozsilverlight mailing list
> ozsilverlight@ozsilverlight.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>
>
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Ria services, Data annotations

2012-03-01 Thread Stephen Price
Try  [DisplayFormat(ConvertEmptyStringToNull = false)]

This post isn't exactly your scenario but it could be related to the
strings you have (nvarchar) and they might be defaulting to null?
http://stackoverflow.com/questions/3129080/server-side-validation-of-a-required-string-property-in-mvc2-entity-framework-4


worth a try anyway :)

the other way is to just set it on the client and then ignore what the
client provides.

On Fri, Mar 2, 2012 at 9:18 AM, David Burela  wrote:
>
> I've got a weird problem.
>
> There are tables in a database with these additional columns
"CreatedById", "ModifiedById". (They are nvarchar, not null)
> There is then an entity framework model for this (again, strings, not
null).
> RIA services is used to share the entities with the client.
>
> The problem is in Silverlight side. If I create a new Product class,
display it in a Dataform to allow the user to edit price, etc. I can't
submit product to the domain service because validation fails "CreatedById
can not be null". It makes no sense to set those values on the client side
as they could spoof those files. I have logic on the domain service side
that looks at the current authenticated user and automatically sets those
fields.
>
> But I can't submit them because validation keeps failing on those 2
fields.
> Is there a [NotRequired] property I could put on the domain service
metadata file?
> -David Burela
>
> ___
> ozsilverlight mailing list
> ozsilverlight@ozsilverlight.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


RE: Ria services, Data annotations

2012-03-01 Thread Sergey Klementiev
Set them client-side to some dummy values inside entity OnCreated

Regards, Sergey

From: ozsilverlight-boun...@ozsilverlight.com 
[mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of David Burela
Sent: Friday, March 02, 2012 11:18 AM
To: ozSilverlight
Subject: Ria services, Data annotations

I've got a weird problem.

There are tables in a database with these additional columns "CreatedById", 
"ModifiedById". (They are nvarchar, not null)
There is then an entity framework model for this (again, strings, not null).
RIA services is used to share the entities with the client.

The problem is in Silverlight side. If I create a new Product class, display it 
in a Dataform to allow the user to edit price, etc. I can't submit product to 
the domain service because validation fails "CreatedById can not be null". It 
makes no sense to set those values on the client side as they could spoof those 
files. I have logic on the domain service side that looks at the current 
authenticated user and automatically sets those fields.

But I can't submit them because validation keeps failing on those 2 fields.
Is there a [NotRequired] property I could put on the domain service metadata 
file?
-David Burela
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight