title: What is Owned Entity? When and why to use Owned Entity in Entity Framework Core?
body: <p>I'm learning Entity Framework Core. I came across the term &quot;Owned Entity&quot; in almost all tutorials.</p>
  <p>Here is one example on using an Owned Entity in Entity Framework Core</p>
  <p><strong>Job Entity:</strong></p>
  <pre class="lang-cs prettyprint-override"><code>public class Job : Entity
  {
      public HiringManagerName HiringManagerName { get; private set; }
  }
  </code></pre>
  <p><strong>HiringManagerName Value Object:</strong></p>
  <pre class="lang-cs prettyprint-override"><code>public class HiringManagerName : ValueObject
  {
      public string First { get; }
      public string Last { get; }
  
      protected HiringManagerName()
      {
      }
  
      private HiringManagerName(string first, string last)
          : this()
      {
          First = first;
          Last = last;
      }
  
      public static Result&lt;HiringManagerName&gt; Create(string firstName, string lastName)
      {
          if (string.IsNullOrWhiteSpace(firstName))
              return Result.Failure&lt;HiringManagerName&gt;(&quot;First name should not be empty&quot;);
          if (string.IsNullOrWhiteSpace(lastName))
              return Result.Failure&lt;HiringManagerName&gt;(&quot;Last name should not be empty&quot;);
  
          firstName = firstName.Trim();
          lastName = lastName.Trim();
  
          if (firstName.Length &gt; 200)
              return Result.Failure&lt;HiringManagerName&gt;(&quot;First name is too long&quot;);
          if (lastName.Length &gt; 200)
              return Result.Failure&lt;HiringManagerName&gt;(&quot;Last name is too long&quot;);
  
          return Result.Success(new HiringManagerName(firstName, lastName));
      }
  
      protected override IEnumerable&lt;object&gt; GetEqualityComponents()
      {
          yield return First;
          yield return Last;
      }
  }
  </code></pre>
  <p><strong>Entity Configuration:</strong></p>
  <pre class="lang-cs prettyprint-override"><code>public class JobConfiguration : IEntityTypeConfiguration&lt;Job&gt;
  {
      public void Configure(EntityTypeBuilder&lt;Job&gt; builder)
      {
          builder.OwnsOne(p =&gt; p.HiringManagerName, p =&gt;
          {
              p.Property(pp =&gt; pp.First)
                  .IsRequired()
                  .HasColumnName(&quot;HiringManagerFirstName&quot;)
                  .HasMaxLength(200);
              p.Property(pp =&gt; pp.Last)
                  .IsRequired()
                  .HasColumnName(&quot;HiringManagerLastName&quot;)
                  .HasMaxLength(200);
          });
      }
  }
  </code></pre>
  <p>And this gets created as two columns in table like other columns in <code>Job Entity</code>.</p>
  <p><a href="https://i.stack.imgur.com/3duL8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3duL8.png" alt="enter image description here" /></a></p>
  <p>Since this is also created as columns just like other properties in entity this can directly be added as normal properties in the Job Entity. Why this needs to be added as Owned Entity?</p>
  <p>Please can anyone help me understand,</p>
  <ol>
  <li>What is owned entity?</li>
  <li>Why we need to use owned entity?</li>
  <li>When to use owned entity?</li>
  </ol>