What is a shadow property?

When animating shadows, such as when multiple shadow values on a box transition to new values on hover, the values are interpolated. Interpolation determines intermediate values of properties, such as the blur radius, spread radius, and color, as shadows transition. For each shadow in a list of shadows, the color, x, y, blur, and spread transition; the color as <color>, and the other values as <length>s.

In interpolating multiple shadows between two comma-separated lists of multiple box shadows, the shadows are paired, in order, with interpolation occurring between paired shadows. If the lists of shadows have different lengths, then the shorter list is padded at the end with shadows whose color is transparent, and X, Y, and blur are 0, with the inset, or lack of inset, being set to match. If, in any pair of shadows, one has inset set and the other is does not, the entire shadow list is uninterpolated; the shadows will change to the new values without an animating effect.

Shadow inventory refers to uninhabited or soon-to-be-uninhabited real estate that has yet to be put on the market. It is most often used to account for those properties that are in the process of foreclosure but that have not yet been sold. It also encompasses homes that owners are waiting to put up for sale until prices improve.

  • Shadow inventory refers to the likely stock of housing that has not yet been placed on the real estate market.
  • Homeowners waiting for the right conditions to sell their homes, or homes working their way through the foreclosure process are the two largest pieces of shadow inventory.
  • Because shadow inventory creates uncertainty around the actual supply of homes soon to be available, it can skew real estate market data and complicate a housing downturn.

Shadow inventory can create uncertainty about the best time to sell and about when a local market can expect a full recovery. In addition, shadow inventory often causes reported housing data to understate the actual number of properties for sale on the market.

Shadow inventory played an important role in the aftermath of the subprime mortgage meltdown of 2007-2008. With the unprecedented number of foreclosures stemming from the housing market collapse during that crisis, lenders were left with significant real estate holdings. Many lenders were slow to put their inventory up for sale for fear of flooding the market with so-called "distressed" properties.

Since distressed properties sell for relatively little, more of them on the market drives down prices, which in turn lowers lenders' potential ROI. After the 2007-2008 financial crisis, however, shadow inventory has thinned out as the housing market has slowly recovered.

Shadow inventories tend to grow when housing markets are struggling. When banks begin to release foreclosed properties at a higher rate, it is a sign that the housing market has bottomed out and is beginning to grow again. Since housing plays such a major role in the overall economy, a smaller shadow inventory generally coincides with strong economic growth.

At the same time, the release of foreclosed properties tempers housing prices overall. This is because distressed properties sell at a much lower price than other homes. When distressed properties make up a large proportion of houses on the market, they drive down prices across the board.

According to the Federal Reserve Bank of Cleveland, foreclosed homes that have been on the market for less than a year sell for 35 percent below value, while those that have been on the market for more than a year sell for 60 percent less. These low prices negatively impact sellers, but they can also help buyers afford homes.

Real estate investors may also benefit from the existence of shadow inventories. Investors who form relationships with REO departments of small banks and credit unions can sometimes buy properties from the shadow inventory before the public knows they are on the market. Likewise, asset managers and real estate agents from larger banks sometimes provide lists of available properties to investors.

Learn how to use the shadow property (also known as the Navigation, Auditable or Tracking property) in Entity Framework Core.

Introduction

In this article, I will demonstrate how to use shadow property in Entity Framework Core, but before that we will see how we are using currently it. This article covers the following topics.

  • What is shadow property
  • The old way to use and access
  • The new way to use and access

What is Shadow Property?

The shadow properties in EF Core are not part of your entity class model but are part of your EF Core model and mapped with your database columns. Shadow property is also called as Navigation, Auditable or Tracking property. (See the Docs.)

The database table contains the shadow properties with names CreatedDate, DeletedDate, UpdatedDate, etc. It cannot be created with the data annotations.

The Old Way to Use and Access

In the old way we used to create a class or interface and inherited into our entity class and on the basis of that the tracking or navigation properties would be added into the database table as shown in the code below.

-- Database entity class with inherited tracking or auditable interface.

public class Shadow : ITracking { public int Id { get; set; } public string Content { get; set; } public DateTime CreatedDate { get; set; } }

-- Auditable or tracking interface we use for createddate, updateddate, etc.

public interface ITracking { DateTime CreatedDate { get; set; } }

-- Setting the navigation or tracking property value in our example, i.e. CreatedDate.

var model = new Shadow(); model.Content = "Old way to set"; model.CreatedDate = DateTime.Now; //setting the value

-- Getting the navigation or tracking property value in our example, i.e. CreatedDate.

var res = db.Shadows.FirstOrDefault(); if (res != null) { Console.WriteLine("Added record Id :- {0}", res.Id); Console.WriteLine("Added record Content :- {0}", res.Content); Console.WriteLine("Added record CreatedDate - {0}", res.CreatedDate);//getting the value }

The newly created database table Shadows with the tracking or navigation properties CreatedDate shown below uses the old way before Entity Framework Core:

What is a shadow property?

The New Way to Use and Access

In the new way, meaning in EF Core, we don't need to create a separate class or interface and inherit in every database entity class. We need to add it in override OnModelCreating method of DbContext as shown in the code below.

-- In the EF Core we need only database entity class.

public class Article { public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } }

-- For single or selected database entity, you can add navigation or shadow property as code below.

protected override void OnModelCreating(ModelBuilder modelBuilder) { //creating navigation or shadow properties for single entity modelBuilder.Entity<Article>().Property<DateTime>("CreatedDate"); }

-- For multiple database entity, you can add navigation or shadow property as code below.

protected override void OnModelCreating(ModelBuilder modelBuilder) { //creating navigation or shadow properties for all entity foreach (var entityType in modelBuilder.Model.GetEntityTypes()) { modelBuilder.Entity(entityType.ClrType) .Property<DateTime>("CreatedDate"); } base.OnModelCreating(modelBuilder); }

-- Setting the navigation or tracking property value in our example, i.e. CreatedDate.

var nwArticle = new Article(); nwArticle.Name = "Shadow Property"; nwArticle.Description = "New way to set"; db.Entry(nwArticle).Property("CreatedDate").CurrentValue = DateTime.Now; //setting the value

-- Getting the navigation or tracking property value in our example, i.e. CreatedDate.

var res = db.Articles.FirstOrDefault(); if (nwFirstOrDefault != null) { Console.WriteLine("Added record Id :- {0}", res.Id); Console.WriteLine("Added record Content :- {0}", res.Name); Console.WriteLine("Added record Description - {0}", res.Description); Console.WriteLine("Added record CreatedDate - {0}", db.Entry(res).Property("CreatedDate").CurrentValue); //getting the value }

The newly created database table Articles with the tracking or navigation properties CreatedDate is shown below using the EF Core way:

What is a shadow property?

You can also download this example from here.

Conclusion

In this article, we discussed what shadow property in Entity Framework Core is, the old way to use and how to access it, and the way using EF Core in a simple example. If you have any suggestions or queries regarding this article, please contact me.

“Learn it, Share it.”