-
Notifications
You must be signed in to change notification settings - Fork 0
configuration options
See the Model Configuration Attributes and Model Configuration Classes sections to see how these configurations are applied to your model.
These options are used to configure UI display and behaviour:
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method)]| Property | Description | Type | Default |
|---|---|---|---|
| CanCreate | Determines if user the can create instances of the class | bool | true |
| CanRead | Determines if user the can read the property | bool | true |
| CanModify | Determines if user the can edit the property | bool | true |
| CanAdd | Determines if user the can add objects to the property | bool | true |
| CanRemove | Determines if user the can remove objects from the property | bool | true |
| CanClear | Determines if user the can clear the property | bool | true |
| CanInvoke | Determines if user the can invoke the method | bool | true |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]| Property | Description | Type | Default |
|---|---|---|---|
| AddMethodName | The name of the Method that adds an item to the collection | string | |
| CanExpandRows | Determines if collection tables support inline row expansion | bool | false |
| RemoveMethodName | The name of the Method that removes an item from the collection | string | |
| VisibleColumnNames | Only shows columns that match the named properties in this array | string[] |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]| Property | Description | Type | Default |
|---|---|---|---|
| SpecificationType | The QuerySpecification used to populate a selection list for the user to select from. | Type |
[AttributeUsage(AttributeTargets.Class)]| Property | Description | Type | Default |
|---|---|---|---|
| RelatedPropertyName | The name of the Property that the method should be rendered against | string | |
| MandatoryPromptText | Displays this text before the method is invoked | string | |
| UnsavedChangesPromptText | Displays this text if the parent object has unsaved changes | string |
[AttributeUsage(AttributeTargets.Class)]| Property | Description | Type | Default |
|---|---|---|---|
| Names | A list of property names that should be hidden in the UI. Note that this is a global list, and applies to all classes/members within your model | string[] |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]| Property | Description | Type | Default |
|---|---|---|---|
| Type | Determines whether objects can be created or added to a property (or collection). See Object Properties and Collection Properties for examples. | RelationshipType | Has |
| Value | Description |
|---|---|
| Has | (aka Aggregation) This object is related to the property's content(s). Deleting this object will not affect these contents. |
| Owns | (aka Composition) This object owns the properties content(s) . Deleting this object should delete the contents too. |
| OwnedBy | This object is owned by the property's content. This is only relevant for objects, not collections. |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]| Property | Description | Type | Default |
|---|---|---|---|
| SpecificationType | The QuerySpecification used to load the content of the associated Collection property. Aka on-demand or lazy-loading. | Type |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]| Property | Description | Type | Default |
|---|---|---|---|
| RenderOption | Determines how the object property is rendered in the panel | UiRenderOption | SeparateTabExpanded |
| PreferredControl | Uses a specific HTML control to render the property or parameter | UiControlType | None |
| TrueValue | The text value to use for boolean TRUE | string | "Yes" |
| FalseValue | The text value to use for boolean FALSE | string | "No" |
| DecimalPlaces | The number of decimal places to show for decimal and float numbers | int | 3 |
| Value | Description |
|---|---|
| InlineSimple | The object is show as a single entry |
| InlineExpanded | The object's properties are expanded |
| SeparateTabExpanded | The object's properties are shown in a separate tab |
Note: These only work if:
- the Fresnel UI supports the HTML5 control
- the applied property or parameter has a suitable type
| Values | ||||||
|---|---|---|---|---|---|---|
| Checkbox | Color | Currency | Date | DateTimeLocal | File | |
| Html | Image | Month | Number | Password | PostalCode | Radio |
| Range | Search | Select | Switch Telephone | Text | TextArea | Time |
| TimeDuration | Upload | Url | Week |
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Parameter)]| Property | Description | Type | Default |
|---|---|---|---|
| IsVisible | Determines if the class or member is visible in the UI | bool | true |
| IsVisibleInLibrary | Determines if the class is shown in the Library panel | bool | true |
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Parameter)]| Property | Description | Type | Default |
|---|---|---|---|
| HtmlColour | The HTML colour to be used | string | |
| IconHtml | The emoji or icon to be shown | string |
These attributes are provided by the .NET framework. Please refer to the .NET documentation for more details.
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]Required on the Id property, to uniquely identify an object.
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]Required on the Version property, to so that the underlying data provider can perform optimistic concurrency checks.
[AttributeUsage(
AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Parameter,
AllowMultiple = false)]These attributes are provided by the .NET framework. Please refer to the .NET documentation for more details.
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]Required on the Id property, to allow it to be persisted via it's IRepository.
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]Required on the Version property, to so that the underlying data provider can perform optimistic concurrency checks.
[AttributeUsage(AttributeTargets.All)]| Property | Description | Type | Default |
|---|---|---|---|
| value | The default values used for the property/parameter in the UI | Any |
It is also possible to provide values that are calculated at run-time. In this example, we specify an IValueProvider that returns the current date/time:
First, create a custom Value Provider:
using Envivo.Fresnel.ModelTypes.Interfaces;
public class DateTimeValueProvider : IValueProvider<object, DateTime>
{
public DateTime GetValue(object context) => DateTime.Now;
}Now apply the 'DefaultValueAttribute' to the property:
[DefaultValue(typeof(DateTimeValueProvider)]
public DateTime OrderPlacementDate { get; set; }At run-time, the DateTimeValueProvider will be used whenever the property appears for a transient instance.
[AttributeUsage(
AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Class,
AllowMultiple = false)]| Property | Description | Type | Default |
|---|---|---|---|
| AutoGenerateField | Determines if the property/parameter is visible in the UI | bool | true |
| DisplayName | Overrides the name shown in the UI | string | |
| GroupName | Members that share the same GroupName value will appear together |
string | |
| Order | Used to enforce the sequence of members in the UI | integer | |
| Prompt | The text to show when the UI field is empty | string |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]| Property | Description | Type | Default |
|---|---|---|---|
| DataFormatString | The format string for rendering the property/parameter value | string |
[AttributeUsage(
AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Class,
AllowMultiple = false)]| Property | Description | Type | Default |
|---|---|---|---|
| Name | Same as DisplayAttribute.DisplayName
|
string |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter,
AllowMultiple = false)]| Property | Description | Type | Default |
|---|---|---|---|
| Length | The maximum allowed length of the string property/parameter | int | 0 |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter,
AllowMultiple = false)]| Property | Description | Type | Default |
|---|---|---|---|
| Length | The minimum allowed length of the string property/parameter | int | 0 |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter,
AllowMultiple = false)]| Property | Description | Type | Default |
|---|---|---|---|
| Minimum | The minimum value allowed on the numeric property/parameter | int/double | 0 |
| Maximum | The maximum value allowed on the numeric property/parameter | int/double | 0 |
| ErrorMessage | A custom message to show if the validation fails | string |
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]Used on properties or parameters whose values are mandatory.
Copyright © 2022-2025 Envivo Software
-
Objects
-
Configuring your Model
-
Testing your model
-
Other features