// Functionality:
 #region CTOR
 internal TabularObjectCollection(string collectionName, TabularObject parent)
 {
     _parent        = parent;
     _handler       = TabularModelHandler.Singleton;
     CollectionName = collectionName;
     Handler.WrapperCollections[CollectionName] = this;
 }
        internal void DoObjectChanging(TabularObject obj, string propertyName, object newValue, ref bool cancel)
        {
            var e = new ObjectChangingEventArgs(obj, propertyName, newValue);

            ObjectChanging?.Invoke(this, e);
            cancel = e.Cancel;
        }
 public ObjectChangingEventArgs(TabularObject tabularObject, string propertyName, object newValue)
 {
     TabularObject = tabularObject;
     PropertyName  = propertyName;
     NewValue      = newValue;
     Cancel        = false;
 }
        internal void DoObjectDeleting(TabularObject obj, ref bool cancel)
        {
            var e = new ObjectDeletingEventArgs(obj);

            ObjectDeleting?.Invoke(this, e);
            cancel = e.Cancel;
        }
 public ObjectChangedEventArgs(TabularObject tabularObject, string propertyName, object oldValue, object newValue)
 {
     TabularObject = tabularObject;
     PropertyName  = propertyName;
     OldValue      = oldValue;
     NewValue      = newValue;
 }
Beispiel #6
0
 internal override ITabularObjectCollection GetCollectionForChild(TabularObject child)
 {
     if (child is KPI)
     {
         return(null);
     }
     return(base.GetCollectionForChild(child));
 }
Beispiel #7
0
        internal void DoObjectChanged(TabularObject obj, string propertyName, object oldValue, object newValue)
        {
            if (_disableUpdates)
            {
                return;
            }

            var e = new ObjectChangedEventArgs(obj, propertyName, oldValue, newValue);

            ObjectChanged?.Invoke(this, e);
        }
Beispiel #8
0
        internal void DoObjectDeleted(TabularObject obj, ITabularNamedObject parentBeforeDeletion)
        {
            if (obj is IFolderObject)
            {
                Tree.RebuildFolderCacheForTable(parentBeforeDeletion as Table);
            }

            var e = new ObjectDeletedEventArgs(obj);

            ObjectDeleted?.Invoke(this, e);
        }
 internal override ITabularObjectCollection GetCollectionForChild(TabularObject child)
 {
     if (child is CalculationItem)
     {
         return(CalculationGroup.CalculationItems);
     }
     if (child is CalculationGroup)
     {
         return(null);
     }
     return(base.GetCollectionForChild(child));
 }
 private static string GetLinqPath(this TabularObject obj)
 {
     switch (obj)
     {
         case KPI kpi:
             return kpi.Measure.GetLinqPath() + ".KPI";
         case Model model:
             return "Model";
         case Column column:
             return string.Format("{0}.Columns[\"{1}\"]", column.Table.GetLinqPath(), column.Name);
         case Measure measure:
             return string.Format("{0}.Measures[\"{1}\"]", measure.Table.GetLinqPath(), measure.Name);
         case Hierarchy hierarchy:
             return string.Format("{0}.Hierarchies[\"{1}\"]", hierarchy.Table.GetLinqPath(), hierarchy.Name);
         case Partition partition:
             return string.Format("{0}.Partitions[\"{1}\"]", partition.Table.GetLinqPath(), partition.Name, obj.GetType().Name);
         case Table table:
             return string.Format("Model.Tables[\"{0}\"]", table.Name);
         case Level level:
             return string.Format("{0}.Levels[\"{1}\"]", level.Hierarchy.GetLinqPath(), level.Name);
         case Perspective perspective:
             return string.Format("{0}.Perspectives[\"{1}\"]", obj.Model.GetLinqPath(), perspective.Name);
         case Culture culture:
             return string.Format("{0}.Cultures[\"{1}\"]", obj.Model.GetLinqPath(), culture.Name);
         case DataSource ds:
             return string.Format("{0}.DataSources[\"{1}\"]", obj.Model.GetLinqPath(), ds.Name, obj.GetType().Name);
         case Relationship rel:
             return string.Format("{0}.Relationships[{1}]", obj.Model.GetLinqPath(), rel.MetadataIndex, obj.GetType().Name);
         case ModelRole role:
             return string.Format("{0}.Roles[\"{1}\"]", obj.Model.GetLinqPath(), role.Name);
         case NamedExpression expression:
             return string.Format("{0}.Expressions[\"{1}\"]", obj.Model.GetLinqPath(), expression.Name);
         case TablePermission tp:
             return string.Format("{0}.TablePermissions[\"{1}\"]", tp.Role.GetLinqPath(), tp.Table.Name);
         case CalculationItem ci:
             return string.Format("{0}.CalculationItems[\"{1}\"]", ci.CalculationGroupTable.GetLinqPath(true), ci.Name);
         case Variation variation:
             return string.Format("{0}.Variations[\"{1}\"]", variation.Column.GetLinqPath(), variation.Name);
         case CalculationGroup cg:
             return string.Format("{0}.CalculationGroup", cg.Table.GetLinqPath(true));
         case AlternateOf altOf:
             return string.Format("{0}.AlternateOf", altOf.Column.GetLinqPath());
         default:
             throw new NotSupportedException();
     }
 }
 public static string GetLinqPath(this TabularObject obj, bool explicitCast = true)
 {
     if (explicitCast)
     {
         switch (obj)
         {
             case Column _:
             case Partition _:
             case Table _:
             case DataSource _:
             case Relationship _:
                 return $"({GetLinqPath(obj)} as {obj.GetType().Name})";
             default:
                 return GetLinqPath(obj);
         }
     }
     else
         return GetLinqPath(obj);
 }
Beispiel #12
0
 protected GenericIndexer(TabularObject parent)
 {
     ParentObject = parent;
     Handler      = parent.Handler;
 }
Beispiel #13
0
 public static string GetObjectPath(this TabularObject obj)
 {
     return(GetObjectPath(obj.MetadataObject));
 }
Beispiel #14
0
 internal virtual ITabularObjectCollection GetCollectionForChild(TabularObject child)
 {
     throw new NotSupportedException("This object does not have any child collections.");
 }
        internal void DoObjectChanged(TabularObject obj, string propertyName, object oldValue, object newValue)
        {
            var e = new ObjectChangedEventArgs(obj, propertyName, oldValue, newValue);

            ObjectChanged?.Invoke(this, e);
        }
 internal TranslationIndexer(TabularObject tabularObject, TranslatedProperty translatedProperty)
 {
     _tabularObject      = tabularObject;
     _translatedProperty = translatedProperty;
 }
 public ObjectDeletedEventArgs(TabularObject tabularObject)
 {
     TabularObject = tabularObject;
 }
        internal void DoObjectDeleted(TabularObject obj)
        {
            var e = new ObjectDeletedEventArgs(obj);

            ObjectDeleted?.Invoke(this, e);
        }
Beispiel #19
0
 // Functionality:
 #region CTOR
 internal TabularObjectCollection(string collectionName, TabularObject parent)
 {
     _parent        = parent;
     _handler       = TabularModelHandler.Singleton;
     CollectionName = collectionName;
 }