News, examples, tips, ideas and plans.
Thoughts around ORM, .NET and SQL databases.

Tuesday, May 03, 2011

DataObjects.Net is updated to build 7487

Hello All,

Today, May 3, both stable versions of DataObjects.Net (v.4.3 & v.4.4) were updated to the latest revision, 7487.

Bugs fixed:

- Field with type of object is not initialized in DTO on query execution. Here is the detailed scenario, although simplified:
public class MyEntity : Entity
{
  [Field, Key]
  public int Id { get; private set; }

  [Field]
  public string Text { get; set; }
}

public class DTO1
{
  public int Id { get; set; }

  public DTO1(MyEntity entity)
  {
    Id = entity.Id;
  }
}

public class DTO2
{
  public object DTO1 { get; set; }
}

using (var session = Domain.OpenSession()) {
  using (var t = session.OpenTransaction()) {

    var q = session.Query.All()
      .Select(c => new DTO2 {DTO1 = new DTO1(c)});
    Assert.IsNotNull(q.First().DTO1);
  }
}

Updates:

- Entity.IsMaterializing flag is added to help distinguishing the case when Entity is being materialized from the case when it is being created via ordinary constructor. Usage:

// Overriding Entity.OnInitialize method
protected override void OnInitialize()
{
  base.OnInitialize();

  if(!IsMaterializing)
    // Make some new entity initialization logic
}

The updated installers as well as binaries can be downloaded from the official website: dataobjects.net.

UPDATE:
The detailed scenario is added to the bug fixed.

5 comments:

  1. Can you provide more detail on bug with DTO?

    ReplyDelete
  2. This is such a great update by Microsoft they have fully divert their application to object oriented program. Because all the latest programing consist the concept of object oriented program. Best Dissertation Writing Services Online

    ReplyDelete