Question: **UPDATED**: I understood I should not use a `DbSet` so I changed the implementation to an ICollection as suggested by Erenga

Please consider the following classes:

```
[Table("Tenant")]
public class Tenant : IEntity
{
    public int Id { get; set; }
    public string Name { get; set; }
    [Key]
    public string Guid { get; set; }
    public virtual ICollection<User> Users { get; set; }
}

[Table("User")]
public class User : IEntity
{
    public int Id { get; set; }

    public string Name { get; set; }
    public string EmailAddress { get; set; }
    public string Password { get; set; }
}

```

The first test creates a new Tenant and a new User and stores them in the appropriate tables.

```
    [Test]
    public void CreateNewUserForNewTenant()
    {
        var user = _applicationContext.Users.Create();
        user.Name = "barney";
        user.EmailAddress = "barney@flinstone.com";

        var tenant = _applicationContext.Tenants.Create();
        tenant.Name = "localhost";
        tenant.Guid = Guid.NewGuid().ToString();

        tenant.Users.Add(user); // NullReferenceException, I expected the EF would LazyLoad the reference to Users?!
        _tenantRepository.Add(tenant);
        _applicationContext.SaveChanges();
    }

```

This test will fail on a `NullReferenceException` since the property Users is not initialized. 

How should I change my code that I can rely on LazyLoading provided with EF?

Answer: 
```
    var tenant = new Tenant
        {
            Name = "localhost",
            Guid = Guid.NewGuid().ToString(),
            Users = new List<User> { user }
        };

```
I think you were expecting something like this (not threadsafe):

```
[Table("Tenant")]
public class Tenant : IEntity
{
    private DbSet<User> _users;

    public int Id { get; set; }
    public string Name { get; set; }
    [Key]
    public string Guid { get; set; }

    public virtual ICollection<User> Users 
    {
        get 
        {
            if (_users == null)
                _users = new List<Users>();

            return _users;
        }
        set { _users = value; }
    }
}

```

I'm sure the `Lazy<T>` class could be utilised somehow too but I am not familiar with that class.