Skip to content
| Marketplace
Sign in
Visual Studio>Tools>DomainValues 2019
DomainValues 2019

DomainValues 2019

Danny Quinn

|
1,424 installs
| (7) | Free
Makes synchronizing database lookup values and enumerations easier.
Download

Domain Values

Makes synchronizing database lookup values and enumerations easier.

Features

  • Syntax Highlighting
  • Validation
  • Automatic alignment of tabular data
  • Works with C# and Visual Basic project types
  • Multiple definitions per file
  • Options for nulls and empty strings

More information on the Wiki

Change Log

Getting Started

In Visual Studio, open a C# or Visual Basic project and open the Add New Item dialog.

image.png

In the Data section, select the Domain values item template, rename the file to Product.dv and then click Add.

A basic file is created from the template using the file name supplied.

image__2.png

In the above example, the file is intended to populate the dbo.Product table.

After the Data keyword the column names are listed separated by the pipe character and each subsequent line represents one row of data. As more lines or columns are added the table automatically formats to keep the columns aligned.

The ProductID column also appears next to the Key keyword and so will be used to determine if a row should be created, updated or deleted.

In the solution explorer, just under the newly created Product.dv file is a second file named Product.dv.sql. This contains the sql statement generated from the contents of product.dv.

Every time the file is saved the sql file will be updated.

To add an enum to the project using the same values, replace the text in Product.dv with the following...

Table dbo.Product
    Key ProductID 
    Enum Products 
    Template ProductName = ProductID 
    Data 
        | ProductID | ProductName |
        | 1         | ProductA    |
        | 2         | ProductB    |

When the file is saved another file will appear. This contains the enumeration code and the language is determined by the project type.

image__3.png

Open the Product.dv.cs file to view the enumeration.

image__4.png

The enum base type and access modifier can be changed, descriptions can be added to each member and the [Flags] attribute can be added.

Using the generated sql file with a database project

Add a database project and create a product table and a post deployment script as below.

image__5.png

Build the solution and then right click the database project and select publish.

Add the connection info and click the publish button.

Once complete the data from the products.dv file will be in the product table.

image__6.png

To keep all the database assets in the database project, use the Copy sql to command in the Product.dv file.

The file can be copied to any folder in the solution (the folder must already exist).

image__7.png

The copied file will be updated anytime a change is made.


  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft