# 3.1: Data

In this model will we set up our Note.cs class.

## 3.1: Entity Model

The entity model represents how we will set up data in our database. The properties we add to this class will be added as columns in our SQL table. This class will also be used by the service layer to persist data and query the database. More on that later.

## Steps

1. In the **Solution Explorer**, right click on **ElevenNote.Data**.
2. Select **Add -> Class** and name it `Note.cs`.

   ![Add Note](https://3258533034-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfMZK4G04fkoGGv%2F-LAxHRfK9utI5Xq6KeGR%2F-LAxHTUwGycL8Q5fVGm7%2F3.0-A.png?generation=1524667905976560\&alt=media)
3. Make this class public. This will make it accessible to other assemblies.&#x20;
4. Add the properties inside of class:

   ```csharp
   namespace ElevenNote.Data
   {
    public class Note
    {
        public int NoteId { get; set; }
        public Guid OwnerId { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }

        public DateTimeOffset CreatedUtc { get; set; }

        public DateTimeOffset? ModifiedUtc { get; set; }
    }
   }
   ```
5. Now, above each of the properties, we need to add data annotations - we'll see [more info](https://eleven-fifty-academy.gitbook.io/dotnet-201-elevennote/elevennote-parts-1-11/part-3-database-setup/3.2-annotations) about data annotations in the next module.

```csharp
namespace ElevenNote.Data
{
    public class Note
    {
        [Key]
        public int NoteId { get; set; }

        [Required]
        public Guid OwnerId { get; set; }

        [Required]
        public string Title { get; set; }

        [Required]
        public string Content { get; set; }

        [Required]
        public DateTimeOffset CreatedUtc { get; set; }

        public DateTimeOffset? ModifiedUtc { get; set; }
    }
}
```

1. Click on one of the annotations and click on `CTRL .` to bring in the using statement for the annotations:

   ![Using statement selection for Annotations](https://3258533034-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LAU8YfMZK4G04fkoGGv%2F-LAxHRfK9utI5Xq6KeGR%2F-LAxHTaTK3cGQumEmliu%2F3.0-B.png?generation=1524667905848745\&alt=media)
