internal new static EntityPartition CreateFromMetadata(Table parent, TOM.Partition metadataObject)
        {
            var obj = new EntityPartition(metadataObject);

            parent.Partitions.Add(obj);

            obj.Init();

            return(obj);
        }
        public new static EntityPartition CreateNew(Table parent, string name = null)
        {
            if (!parent.Handler.PowerBIGovernance.AllowCreate(typeof(EntityPartition)))
            {
                throw new InvalidOperationException(string.Format(Messages.CannotCreatePowerBIObject, typeof(EntityPartition).GetTypeName()));
            }

            var metadataObject = new TOM.Partition();

            metadataObject.Name   = parent.Partitions.GetNewName(string.IsNullOrWhiteSpace(name) ? "New " + typeof(EntityPartition).GetTypeName() : name);
            metadataObject.Source = new TOM.EntityPartitionSource();

            var obj = new EntityPartition(metadataObject);

            parent.Partitions.Add(obj);

            obj.Init();

            return(obj);
        }