Home > Entity Framework > CodeFluent Entities vs Entity Framework: Cascade save

CodeFluent Entities vs Entity Framework: Cascade save


To avoid handling every relations in your data model, you may want to ask your access layer to synchronize update operations across related entities.

Entity Framework

With Entity Framework you will not have any feature available to automate a cascade save treatment. This Framework only offers you the way to save entities in your entire context. This is not really a cascading operation as it can be with the SQL Server “cascade delete” but it can do the tricks.

CodeFluent Entities

With CodeFluent Entities you can add a relation:

Then, you can configure the « save » cascading operations:

 

Cascade Save

 

Unlike the Cascade Delete feature which modify the generated stored procedure, it will only change the C# code:

public partial class Client : // ... 
    {

        public virtual bool Save()
        {
            if ((this._orders != null))
            {
                this.Orders.SaveAll();
            }
            bool localSave = this.BaseSave(false);
            return localSave;
        }

        // ...
    }

Simple and clean!

Conclusion

Entity Framework doesn’t include a cascade save feature.

CodeFluent Entities asks you for every relation  to configure an optional operation mode for your save related operations.

References:

  1. No comments yet.
  1. No trackbacks yet.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s