public static EditOperationType?GetEditOperationType(this BasicFeatureLayer layer)
        {
            if (layer.ConnectionStatus == ConnectionStatus.Broken)
            {
                return(null);
            }
            var gdbType = layer.GetGeodatabaseType();
            var regType = layer.GetRegistrationType();

            //Plugin - new at 2.3
            if (gdbType == null)
            {
                return(null);
            }
            //FileSystem
            if (gdbType == GeodatabaseType.FileSystem)
            {
                return(EditOperationType.Long);
            }
            //LocalDatabase
            if (gdbType == GeodatabaseType.LocalDatabase)
            {
                return(EditOperationType.Long);
            }
            //RemoteDatabase, Versioned
            if (gdbType == GeodatabaseType.RemoteDatabase && (
                    regType == RegistrationType.Versioned || regType == RegistrationType.VersionedWithMoveToBase))
            {
                return(EditOperationType.Long);
            }
            //RemoteDatabase, NonVersioned
            if (gdbType == GeodatabaseType.RemoteDatabase && regType == RegistrationType.Nonversioned)
            {
                return(EditOperationType.Short);
            }
            //Service, NonVersioned
            if (gdbType == GeodatabaseType.Service && regType == RegistrationType.Nonversioned)
            {
                return(EditOperationType.Short);
            }

            //Service, Versioned, Default
            EditOperationType forBranch = EditOperationType.Long;

            if (gdbType == GeodatabaseType.Service && regType == RegistrationType.Versioned)
            {
                using (var dataset = layer.GetTable())
                    using (var gdb = dataset.GetDatastore() as Geodatabase)
                        using (var vmgr = gdb.GetVersionManager())
                            using (var vers = vmgr.GetCurrentVersion())
                                using (var parent = vers.GetParent())
                                {
                                    //non-default supports undo/redo and save/discard. Default does not
                                    forBranch = parent != null ? EditOperationType.Long : EditOperationType.Short;
                                }
            }
            return(forBranch);
        }