I was afraid you were going to need this for a specific operation within the wider application. There's no built-in way to pass some sort of tag along with the save to identify a specific "batch", unlike a query which does have a Tag property. You can simulate this, however, by adding a Tag (or whatever you want to call it) to the entity definition(s) for any entities you might work with in the batch. If there are quite a few entities, then maybe add the property to a base class. As long as the property has a public getter and setter and is marked as a DataMember, it will be serialized with the rest of the entity properties when the save is requested. This is unfortunately not secure though, since it allows the client application to turn off server validation, so you'd need to take care that only authorized users can perform saves.
Here's a simple example -
public partial class Lead {
System.Runtime.Serialization.DataMember]
public bool BypassServerValidation { get; set; }
}
In the save interceptor -
protected override bool ValidateSave() {
var changes = EntityManager.FindEntities(EntityState.AnyAddedModifiedOrDeleted).OfType<Lead>();
if (changes.Any(e => e.BypassServerValidation)) {
return true;
} else {
return base.ValidateSave();
}
}
Another option, if you can use a separate EntityManager for the batch, is to use a different CompostionContext for the batch, and define a custom save interceptor which bypasses validation for this CompositionContext only. This is likely not as complicated as it sounds, and if you're interested I'll get a quick sample together for you.