MicroLite 5.0 – Removal of InsertOrUpdate

Another of the changes to the API in MicroLite 5.0 is the removal of the InsertOrUpdate(object) method on ISession.

The reason for the removal is that it only worked correctly if you used the IdentifierStrategy.DbGenerated. In the interest of keeping the API small and not having methods which only work in specific scenarios it has been removed.

If you use the IdentifierStrategy.DbGenerated and wish to keep using this method, you can use the following extension method:

public static void InsertOrUpdate(this ISession session, object instance)
    var objectInfo = ObjectInfo.For(instance.GetType());

    if (objectInfo.HasDefaultIdentifierValue(instance))

1 thought on “MicroLite 5.0 – Removal of InsertOrUpdate

  1. Pingback: MicroLite 5.0 Released | MicroLite ORM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s