Пример #1
0
 public void AddCalculationItem(CalculationGroup calcGroup, Tom.CalculationItem tomCalcItem)
 {
     Dax.Metadata.CalculationItem calcItem = new CalculationItem(calcGroup)
     {
         ItemExpression         = DaxExpression.GetExpression(tomCalcItem.Expression),
         FormatStringDefinition = DaxExpression.GetExpression(tomCalcItem.FormatStringDefinition?.Expression),
         ItemName                 = new Dax.Metadata.DaxName(tomCalcItem.Name),
         State                    = tomCalcItem.State.ToString(),
         ErrorMessage             = tomCalcItem.ErrorMessage,
         FormatStringState        = tomCalcItem.FormatStringDefinition?.State.ToString(),
         FormatStringErrorMessage = tomCalcItem.FormatStringDefinition?.ErrorMessage
     };
     calcGroup.CalculationItems.Add(calcItem);
 }
Пример #2
0
        private void AddRole(Tom.ModelRole role)
        {
            Dax.Metadata.Role daxRole = new Role(DaxModel)
            {
                RoleName = new DaxName(role.Name)
            };
            foreach (var tablePermission in role.TablePermissions)
            {
                Dax.Metadata.Table           table = DaxModel.Tables.SingleOrDefault(t => t.TableName.Name == tablePermission.Table.Name);
                Dax.Metadata.TablePermission daxTablePermission = new TablePermission(daxRole)
                {
                    Table            = table,
                    FilterExpression = DaxExpression.GetExpression(tablePermission.FilterExpression)
                };

                daxRole.TablePermissions.Add(daxTablePermission);
            }

            DaxModel.Roles.Add(daxRole);
        }