Up Refine in the EDM Designer
Model » Create the entity data model » Refine in the EDM Designer » Set property default value

Set property default value

Last modified on August 15, 2012 17:22

You can see and set a property's default value in the EDM Designer

This screen shows that Customer.CompanyName has been given a default value of "--unknown--".

EdmDesignerDefaultValue.png

The EDM Designer adds this default to the definition of the CompanyName property.

<Property Name="CompanyName" ... DefaultValue="--unknown--" />

The range of default values is constrained. For example, you can't enter a string that contains characters such as '<' and '>' that are reserved in XML. You can't enter functions either.

DevForce code generation adds a corresponding DefaultValueAttribute to the generated CompanyName property.

C#
    [DefaultValue("--unknown--")]
   public string CompanyName { ... }
VB
    <DefaultValue("--unknown--")>
   Public Property CompanyName As String ...

Finally, DevForce reads the attribute at runtime and records the default in its metadata. 

The entity creation topic explains how this model default value is used.

Tags: Model EDM
Created by DevForce on March 22, 2011 16:26

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2020 IdeaBlade