Dreamine.MVVM.Attributes is a lightweight attribute library used by the Dreamine MVVM ecosystem.
This package does not implement MVVM behavior by itself.
Instead, it provides declarative markers consumed by Dreamine tooling such as source generators and supporting runtime modules.
It is designed to reduce repetitive ViewModel code while keeping the codebase explicit, readable, and maintainable.
In MVVM projects, repetitive patterns appear frequently:
- private field → public property generation
- method → command property generation
- ViewModel ↔ Model proxy mapping
- entry type or structural role marking
- command methods that forward calls to event/service targets
This package standardizes those patterns through attributes only, so higher-level Dreamine tooling can generate the required code consistently.
- Attribute-only package with a low dependency footprint
- Designed for Dreamine MVVM source-generation workflows
- Supports property generation markers
- Supports command generation markers
- Supports entry/model/event structural markers
- Supports ViewModel → Model proxy property mapping
- Targets
netstandard2.0for broad compatibility
- Target Framework:
netstandard2.0 - Typically used together with:
- Dreamine MVVM generator packages
- Dreamine MVVM runtime/core packages
- WPF or other .NET desktop MVVM projects
dotnet add package Dreamine.MVVM.Attributes<ItemGroup>
<PackageReference Include="Dreamine.MVVM.Attributes" Version="1.0.4" />
</ItemGroup>Dreamine.MVVM.Attributes
├── DreamineCommandAttribute.cs
├── DreamineEntryAttribute.cs
├── DreamineEventAttribute.cs
├── DreamineModelAttribute.cs
├── DreamineModelPropertyAttribute.cs
├── DreaminePropertyAttribute.cs
└── RelayCommandAttribute.cs
This package belongs to the declaration layer of the Dreamine MVVM stack.
ViewModel Source Code
│
├─ Dreamine.MVVM.Attributes
│ (markers / metadata)
│
├─ Dreamine Generator
│ (code generation)
│
└─ Dreamine Runtime/Core
(execution / MVVM infrastructure)
The attributes declare intent, while other Dreamine packages implement the actual behavior.
This separation helps keep responsibilities clear:
- Attributes describe metadata only
- Generators produce code from that metadata
- Runtime packages execute the generated behavior
using Dreamine.MVVM.Attributes;
public partial class MainViewModel
{
[DreamineProperty]
private string _title;
}Typical intent:
- field-based declaration
- generated public property
- property change notification handled by generator/runtime
using Dreamine.MVVM.Attributes;
public partial class MainViewModel
{
[RelayCommand]
private void Save()
{
}
}Typical intent:
- method marked as command source
- command property generated automatically
- command naming defaults to
{MethodName}Command
using Dreamine.MVVM.Attributes;
[DreamineEntry]
public partial class App
{
}Typical intent:
- marks an application entry or bootstrap type
- useful for discovery/bootstrap scenarios
- makes the intended entry role explicit to Dreamine tooling
using Dreamine.MVVM.Attributes;
public partial class MainViewModel
{
[DreamineModelProperty]
private string _readme;
}Typical intent:
- bind a ViewModel field to a Model property proxy
- generator maps the property to
Model.Readmeor a specified model property
using Dreamine.MVVM.Attributes;
public partial class MainViewModel
{
[DreamineCommand("Event.ReadmeClick", BindTo = "Readme")]
partial void LoadReadme();
}Typical intent:
- generate a command that invokes a target method path
- support target paths such as
Event.*orService.* - optionally assign the returned value to a property via
BindTo
Marks a field for generated property creation.
[DreamineProperty]
private string _name;Optional parameter:
propertyName: explicitly overrides the generated property name
Marks a method for generated command creation.
[RelayCommand]
private void Save()
{
}Optional parameter:
commandName: explicitly overrides the generated command property name
Marks a method for target-method invocation scenarios.
[DreamineCommand("Service.Load", BindTo = "Result")]
partial void Load();Members:
TargetMethod: target method pathBindTo: optional property that receives the return valueCommandName: optional explicit command property name
Use this attribute when a generated command must delegate execution to a known target path rather than directly wrapping the annotated method body.
Marks a class as an entry or bootstrap type.
[DreamineEntry]
public partial class App
{
}Useful for:
- startup discovery
- generator scanning rules
- explicit architectural intent
Marks a class or field as part of the model-related structure.
[DreamineModel]
private MainModel _model;Typical interpretation:
- on a class: identifies the type as model-related metadata
- on a field: identifies a model-related member for generation or interpretation
Optional parameter:
propertyName: explicit generated property name
Marks a class or field as part of the event-related structure.
[DreamineEvent]
private MainEvent _event;Typical interpretation:
- on a class: identifies the type as event-related metadata
- on a field: identifies an event-related member for generation or interpretation
Optional parameter:
propertyName: explicit generated property name
Maps a ViewModel field to a Model property proxy.
[DreamineModelProperty("Readme")]
private string _readme;Optional parameter:
modelPropertyName: explicit model property name
This package intentionally keeps the attribute layer small and dependency-free.
That means:
- no MVVM runtime logic inside the package
- no command implementation inside the package
- no property notification implementation inside the package
- only metadata and declaration markers
This separation aligns well with the overall architectural goal of keeping responsibilities isolated:
- the attribute package focuses on declaration only
- generators can evolve independently
- runtime behavior stays outside the declaration layer
| Package | Role | Runtime Logic | Code Generation Markers |
|---|---|---|---|
| CommunityToolkit.Mvvm | MVVM toolkit | Yes | Yes |
| Prism | MVVM framework | Yes | No |
| Dreamine.MVVM.Attributes | Attribute declarations | No | Yes |
Dreamine.MVVM.Attributes is intentionally focused on the declaration layer, not the full runtime framework.
This package is most useful when combined with:
Dreamine.MVVM.Core
Dreamine.MVVM.Generators
Dreamine runtime / UI packages
By itself, this package mainly defines metadata for higher-level Dreamine tooling.
MIT License