Questions tagged [isrequired]

9 questions
15
votes
2 answers

Is the DataMember IsRequired attribute in combination with a Nullable type contradictory?

I came across this today in a WCF contract: [DataMember(IsRequired = true)] public DateTime? LastModified { get; set; } What are the consequences of IsRequired = True and a nullable DateTime? They appear to be contradictory to each other.
Rebecca
  • 13,914
  • 10
  • 95
  • 136
12
votes
1 answer

Adding a DataMember to an existing DataContract in WCF

I would like to add a DataMember to one of my DataContracts. I would like to know how existing servers and clients will behave in the presence of a new DataMember if one of the parties isn't updated. I recall there is a way to make the DataMember…
Jader Dias
  • 88,211
  • 155
  • 421
  • 625
6
votes
2 answers

MVC HtmlHelper vs FluentValidation 3.1: Troubles getting ModelMetadata IsRequired

I created a HtmlHelper for Label that puts a star after the name of that Label if associated field is required: public static MvcHtmlString LabelForR( this HtmlHelper html, Expression>…
5
votes
1 answer

WCF Data Contract - best/cleanest way to enforce required values?

I have a WCF data contract with a bunch of properties of primitive types like int and decimal, and DateTime (which is, of course, a struct). My co-worker suggested making them all nullable and then validating required values on the service end by…
lintmouse
  • 5,079
  • 8
  • 38
  • 54
1
vote
0 answers

React: isRequired is not working when having a default prop for that required property

I have a field score which is required. I want to provide a default value for it as a fallback, so the warning will be displayed in console but the app will work as normal meanwhile. Score.defaultProps = { dot : false, score:…
0
votes
1 answer

Works incompelete Fluent API in migration

I created a model called ProductCategory (image #1) and configured this class using the Fluent API method (image #2), but unfortunately when I create Migration, all the configurations including the main key, the length of the allowed character…
0
votes
1 answer

WCF - IsRequired doesn't cause an exception, even when the client doesn't supply the required value

I have a simple entity, and one of its property is required: [DataContract] public class Person { [DataMember] public string FirstName { get; set; } [DataMember (IsRequired=true)] public string LastName { get;…
S Itzik
  • 494
  • 3
  • 12
0
votes
1 answer

WCF IDictionary - How to indicate that TValue can be null?

Basically, I want to pass back the following in my WCF service: [DataMember(IsRequired = true)] IDictionary objects { get; set; } How can I make it so that the MyObj can be null so that when I receive it on the other end it doesn't…
michael
  • 14,844
  • 28
  • 89
  • 177
0
votes
0 answers

Should I null or add new "not selected" values?

I have an MVVM application, EF code first. In my model I have an Appointment entity and this entity has navigation properties which are Types such as AppointmentType; AppointmentDuration; AppointmentConsultant. These were all specified as 1-1 in…
CheGuevarasBeret
  • 1,364
  • 2
  • 14
  • 33