public override string ToScript(ScriptingContext?context)
        {
            var builder = new StringBuilder();

            builder.Append(".alter ");
            builder.Append(EntityType == EntityType.Table ? "table" : "database");
            builder.Append(" ");
            if (EntityType == EntityType.Database && context?.CurrentDatabaseName != null)
            {
                builder.Append(context.CurrentDatabaseName.ToScript());
            }
            else
            {
                builder.Append(EntityName.ToScript());
            }
            builder.Append(" policy caching ");
            if (HotData.Equals(HotIndex))
            {
                builder.Append("hot = ");
                builder.Append(HotData);
            }
            else
            {
                builder.Append("hotdata = ");
                builder.Append(HotData);
                builder.Append(" hotindex = ");
                builder.Append(HotIndex);
            }

            return(builder.ToString());
        }
        internal static CommandBase FromCode(SyntaxElement rootElement)
        {
            var entityKinds = rootElement
                              .GetDescendants <SyntaxElement>(s => s.Kind == SyntaxKind.TableKeyword ||
                                                              s.Kind == SyntaxKind.DatabaseKeyword)
                              .Select(s => s.Kind);

            if (!entityKinds.Any())
            {
                throw new DeltaException("Alter caching policy requires to act on a table or database (cluster isn't supported)");
            }
            var entityKind = entityKinds.First();
            var entityType = entityKind == SyntaxKind.TableKeyword
                ? EntityType.Table
                : EntityType.Database;
            var entityName = rootElement
                             .GetDescendants <NameReference>(n => n.NameInParent == "TableName" ||
                                                             n.NameInParent == "DatabaseName" ||
                                                             n.NameInParent == "Selector")
                             .Last();

            var(hotData, hotIndex) = ExtractHotDurations(rootElement);

            return(new AlterCachingPolicyCommand(
                       entityType,
                       EntityName.FromCode(entityName.Name),
                       hotData,
                       hotIndex));
        }
Exemplo n.º 3
0
        public static bool Load(string path, [MaybeNullWhen(false)] out EntityTemplate template, [MaybeNullWhen(true)] out string error)
        {
            if (!File.Exists(path))
            {
                template = null;
                error    = "the template file was not found";
                return(false);
            }

            var source = File.ReadAllText(path);

            if (!JsonTemplateParser.TryParse(source, out var root, out var parseError, out _))
            {
                template = null;
                error    = parseError;
                return(false);
            }

            if (root is not JsonTemplateObject rootDictionary ||
                !rootDictionary.Members.TryGetValue("$entity", out var resourceToken) ||
                resourceToken is not JsonTemplateString resource ||
                resource.Value is null)
            {
                template = null;
                error    = "the template must include an `$entity` property";
                return(false);
            }

            var resourceGroup = EntityName.ToResourceGroup(resource.Value);
            var filename      = Path.GetFileName(path);

            template = new EntityTemplate(resourceGroup, filename, root);
            error    = null;
            return(true);
        }
Exemplo n.º 4
0
 private TableModel(
     EntityName tableName,
     IEnumerable <ColumnModel> columns,
     IEnumerable <MappingModel> mappings,
     AlterAutoDeletePolicyCommand?autoDeletePolicy,
     AlterCachingPolicyCommand?cachingPolicy,
     AlterIngestionBatchingPolicyCommand?ingestionBatchingPolicy,
     AlterMergePolicyCommand?mergePolicy,
     AlterRetentionPolicyCommand?retentionPolicy,
     AlterShardingPolicyCommand?shardingPolicy,
     AlterUpdatePolicyCommand?updatePolicy,
     QuotedText folder,
     QuotedText docString)
 {
     TableName = tableName;
     Columns   = columns.ToImmutableArray();
     Mappings  = mappings
                 .OrderBy(m => m.MappingName)
                 .ThenBy(m => m.MappingKind)
                 .ToImmutableArray();
     AutoDeletePolicy        = autoDeletePolicy;
     CachingPolicy           = cachingPolicy;
     IngestionBatchingPolicy = ingestionBatchingPolicy;
     MergePolicy             = mergePolicy;
     RetentionPolicy         = retentionPolicy;
     ShardingPolicy          = shardingPolicy;
     UpdatePolicy            = updatePolicy;
     Folder    = folder;
     DocString = docString;
 }
Exemplo n.º 5
0
        private void AnalyzeTypeReference(EntityName entityName)
        {
            var typeName         = entityName.GetAtomsFromQualifiedName();
            var typeNameAsString = string.Join(".", typeName);

            AddOrCreateReferencedSymbol(SymbolKind.TypeReference, typeNameAsString);
        }
Exemplo n.º 6
0
        private void AddDelete()
        {
            var properties = GetPropertiesForComparison(EntityName);

            if (properties.Count() != 1)
            {
                Pass.Builder.BuilderWarning(Pass.BuildSection.ToString(), GetWarningMessage());
                return;
            }

            if (Settings.IsIncludeCrudEntity)
            {
                Add(Tab(2), "public void Delete(int id)");
            }
            else
            {
                Add(Tab(2), string.Format("public void Delete({0} {1})", EntityName, EntityName.LowerCaseFirstCharacter()));
            }

            Add(Tab(2), "{");

            if (Settings.IsIncludeCrudEntity)
            {
                Add(Tab(3), string.Format("var {0}ToDelete = Update{1}(new {1} {{ {2} = id }}, false, true, true).Entity;", EntityName.LowerCaseFirstCharacter(), EntityName, properties.First()));
                Add(Tab(3), string.Format("Context.{0}.Remove({1}ToDelete);", EntityNamePluralized, EntityName.LowerCaseFirstCharacter()));
            }
            else
            {
                Add(Tab(3), string.Format("Context.{0}.ApplyChanges({1});", EntityNamePluralized, EntityName.LowerCaseFirstCharacter()));
            }

            Add(Tab(2), "}");
        }
Exemplo n.º 7
0
 public override int GetHashCode()
 {
     return((GetType().FullName +
             "|entityid" + this.EntityId +
             "|entityname" + EntityName.ToLower() +
             "|propname" + LockedPropertyName.ToLower()).GetHashCode());
 }
Exemplo n.º 8
0
        public void InsertEntityGraphSingles()
        {
            var    debugToken  = "InsertEntityGraphSingles()";
            Entity myNewEntity = new Entity {
                Type = 0, SecurityType = 1, DebugToken = debugToken
            };
            EntityName myNewEntityName = new EntityName {
                First = "joe", Last = "blow", Type = 0, DebugToken = debugToken
            };
            EntityAddress myNewEntityAddress = new EntityAddress {
                Address1 = "addy1", City = "MyCity", State = "MyState", PostalCode = "12345", Country = "whoknows", Type = 0
            };
            EntityPhone myNewEntityPhone = new EntityPhone {
                Type = 0, Phone = "1112223333"
            };
            EntityEmail myNewEntityEmail = new EntityEmail {
                Type = 0, Email = "*****@*****.**"
            };
            EntityCreditCard myNewEntityCreditCard = new EntityCreditCard {
                Type = 0, CC = "123", Code = 123, ExpirationMonth = "2", ExpirationYear = "2017"
            };
            EntitySocialMedia myNewEntitySocialMedia = new EntitySocialMedia {
                Type = 0, Url = "somethingcool.com", Login = "******", PW = "pw"
            };

            myNewEntity.Names.Add(myNewEntityName);
            myNewEntity.Addresses.Add(myNewEntityAddress);
            myNewEntity.Phones.Add(myNewEntityPhone);
            myNewEntity.Emails.Add(myNewEntityEmail);
            myNewEntity.CreditCards.Add(myNewEntityCreditCard);
            myNewEntity.SocialMedia.Add(myNewEntitySocialMedia);
            SaveEntityChanges(myNewEntity);
        }
Exemplo n.º 9
0
        private void CreateOwnersBisa()
        {
            EntityType banks = new EntityType()
            {
                EntityTypeId = Guid.NewGuid(),
                Name         = "Banks",
                Description  = "Banks organizations"
            };

            _spacePlanningUnitOfWork.EntityTypeRepository.Add(banks);
            Entity bisaBank = new Entity()
            {
                EntityId     = Guid.NewGuid(),
                Name         = "BISA Bank",
                Description  = "BISA Bank",
                EntityTypeId = banks.EntityTypeId
            };

            _spacePlanningUnitOfWork.EntityRepository.Add(bisaBank);
            Name principalOwner = new Name()
            {
                First  = "Juan", Middle = "Jose", Last = "Campos",
                NameId = Guid.NewGuid(), Prefix = "jc", Suffix = "jc"
            };

            ownerBank = new EntityName()
            {
                Name = principalOwner, Entity = bisaBank
            };
            _spacePlanningUnitOfWork.Save();
        }
        public void GetEntityRequestObject()
        {
            moq::Mock <MetadataService.MetadataServiceClient> mockGrpcClient = new moq::Mock <MetadataService.MetadataServiceClient>(moq::MockBehavior.Strict);
            GetEntityRequest request = new GetEntityRequest
            {
                EntityName = EntityName.FromProjectLocationLakeZoneEntity("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]"),
                View       = GetEntityRequest.Types.EntityView.Basic,
            };
            Entity expectedResponse = new Entity
            {
                EntityName      = EntityName.FromProjectLocationLakeZoneEntity("[PROJECT]", "[LOCATION]", "[LAKE]", "[ZONE]", "[ENTITY]"),
                DisplayName     = "display_name137f65c2",
                Description     = "description2cf9da67",
                CreateTime      = new wkt::Timestamp(),
                UpdateTime      = new wkt::Timestamp(),
                Id              = "id74b70bb8",
                Etag            = "etage8ad7218",
                Type            = Entity.Types.Type.Unspecified,
                Asset           = "assetd4344ec0",
                DataPath        = "data_path6b0d38a8",
                DataPathPattern = "data_path_pattern534aa82f",
                CatalogEntry    = "catalog_entry0c83a523",
                System          = StorageSystem.CloudStorage,
                Format          = new StorageFormat(),
                Compatibility   = new Entity.Types.CompatibilityStatus(),
                Schema          = new Schema(),
            };

            mockGrpcClient.Setup(x => x.GetEntity(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            MetadataServiceClient client = new MetadataServiceClientImpl(mockGrpcClient.Object, null);
            Entity response = client.GetEntity(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 11
0
 // I return all cars
 public List <Car> returnAllCars()
 {
     using (EntityName e = new EntityName())
     {
         return(e.Car.ToList());
     }
 }
Exemplo n.º 12
0
        public void ShouldUpdateEntityNameWhenDBContextIsValid()
        {
            CreateOwnersBisa();
            _spacePlanningUnitOfWork.EntityNameRepository.Add(ownerBank);
            Entity bisa     = ownerBank.Entity;
            Name   newOwner = new Name()
            {
                First  = "Luis", Middle = "Pedro", Last = "Rios",
                NameId = Guid.NewGuid(), Prefix = "lpr", Suffix = "lpr"
            };

            _spacePlanningUnitOfWork.NameRepository.Add(newOwner);
            _spacePlanningUnitOfWork.EntityNameRepository.Delete(ownerBank);
            EntityName newOwnerBisa = new EntityName()
            {
                Entity = bisa, Name = newOwner
            };

            _spacePlanningUnitOfWork.EntityNameRepository.Add(newOwnerBisa);
            _spacePlanningUnitOfWork.Save();
            EntityName currentOwner = _spacePlanningUnitOfWork.EntityNameRepository.GetById(newOwnerBisa.NameId,
                                                                                            newOwnerBisa.EntityId);

            Assert.AreEqual("Luis", currentOwner.Name.First);
            Assert.AreEqual("Pedro", currentOwner.Name.Middle);
            Assert.AreEqual("Rios", currentOwner.Name.Last);
            Assert.AreEqual("lpr", currentOwner.Name.Prefix);
        }
Exemplo n.º 13
0
 private string SafeDeclareName(string declareName)
 {
     declareName = SafeIdentifier(declareName);
     if (declareName.ToLower() == EntityName.ToLower())
     {
         return(declareName + "1");
     }
     if (declareName.ToLower() == "EntityLogicalName".ToLower())
     {
         return(declareName + "1");
     }
     if (declareName.ToLower() == "EntityTypeCode".ToLower())
     {
         return(declareName + "1");
     }
     if (declareName.ToLower() == "Entity".ToLower())
     {
         return(declareName + "1");
     }
     if (declareName.ToLower() == "Id".ToLower())
     {
         return(declareName + "1");
     }
     return(declareName);
 }
Exemplo n.º 14
0
        public ModuleConfig(JObject conf)
        {
            var cfgRole = conf["Role"]?.Value <string>();

            if (string.IsNullOrWhiteSpace(cfgRole))
            {
                throw new RuleImportException("Role was not specified.");
            }
            _cfgRole = new EntityName(cfgRole, EntityType.Role);

            var inTime = conf["WaitTime"]?.Value <string>();

            if (string.IsNullOrWhiteSpace(inTime))
            {
                throw new RuleImportException("WaitTime was not specified.");
            }

            if (!int.TryParse(inTime, out _cfgTime))
            {
                throw new RuleImportException("WaitTime must be a numeric value.");
            }
            if (_cfgTime < 0)
            {
                throw new RuleImportException("WaitTime must be a positive integer.");
            }
        }
        private void BuildRootMethods()
        {
            Add(Tab(2), "#region Methods (Root)");

            if (Settings.IsIncludeCrud)
            {
                Add(Tab(2), string.Format("IEnumerable<{0}> Get{0}All();", EntityName), NewLine());
                Add(Tab(2), string.Format("{0} Get{0}ById(int id);", EntityName), NewLine());
                Add(Tab(2), string.Format("IServiceResponse<{0}, IBedrockEntity> Add{0}({0} {1});", EntityName, EntityName.LowerCaseFirstCharacter()), NewLine());

                if (Settings.IsIncludeCrudEntity)
                {
                    Add(Tab(2), string.Format("IServiceResponse<{0}, IBedrockEntity> Add{0}({0} {1}, bool isAddChildren);", EntityName, EntityName.LowerCaseFirstCharacter()), NewLine());
                }

                Add(Tab(2), string.Format("IServiceResponse<{0}, IBedrockEntity> Update{0}({0} {1});", EntityName, EntityName.LowerCaseFirstCharacter()), NewLine());

                if (Settings.IsIncludeCrudEntity)
                {
                    Add(Tab(2), string.Format("IServiceResponse<{0}, IBedrockEntity> Update{0}({0} {1}, bool isUpdateChildren, bool isAddChildren, bool isDeleteChildren);", EntityName, EntityName.LowerCaseFirstCharacter()), NewLine());
                }

                if (Settings.IsIncludeCrudEntity)
                {
                    Add(Tab(2), "void Delete(int id);, NewLine()");
                }
                else
                {
                    Add(Tab(2), string.Format("void Delete({0} {1});", EntityName, EntityName.LowerCaseFirstCharacter()));
                }
            }

            Add(false, Tab(2), "#endregion");
        }
Exemplo n.º 16
0
    /// <summary>
    /// Gets the name of the table given an entity type (or proxy) and a db context.
    /// </summary>
    /// <param name="type">The entity type (or proxy).</param>
    /// <param name="context">The db context.</param>
    public EntityName GetTableName(Type type, DbContext context)
    {
        type = GetObjectEntityType(type);
        EntityName name;

        if (_tableNamesCache.TryGetValue(type, out name))
        {
            return(name);
        }
        // Get the type mapping
        var mappingFragment = GetMappingFragment(type, context);

        // Find the storage entity set (table) that the entity is mapped
        var table = mappingFragment.StoreEntitySet;

        // Return the table name from the storage entity set
        name = new EntityName()
        {
            Table  = (string)table.MetadataProperties["Table"].Value ?? table.Name ?? type.Name,
            Schema = table.Schema
        };

        _tableNamesCache[type] = name;
        return(name);
    }
Exemplo n.º 17
0
 private DropMappingCommand ToDropMappingCommand(EntityName tableName)
 {
     return(new DropMappingCommand(
                tableName,
                MappingKind,
                MappingName));
 }
Exemplo n.º 18
0
 public RouteTableElement(EntityName entityName, string languageKeyCode, PageType pageType, string content)
 {
     this.Content         = content;
     this.LanguageKeyCode = languageKeyCode;
     this.PageType        = pageType;
     this.EntityName      = entityName;
 }
Exemplo n.º 19
0
        internal static IEnumerable <CommandBase> ComputeDelta(
            EntityName tableName,
            IEnumerable <MappingModel> currentMappings,
            IEnumerable <MappingModel> targetMappings)
        {
            var createdModels = DeltaHelper.GetCreated(
                currentMappings,
                targetMappings,
                m => (m.MappingName, m.MappingKind));
            var updatedModels = DeltaHelper.GetUpdated(
                currentMappings,
                targetMappings,
                m => (m.MappingName, m.MappingKind));
            var droppedModels = DeltaHelper.GetDropped(
                currentMappings,
                targetMappings,
                m => (m.MappingName, m.MappingKind));
            var createCommands = createdModels
                                 .Concat(updatedModels.Select(p => p.after))
                                 .Select(m => m.ToCreateMappingCommand(tableName));
            var dropCommands = droppedModels
                               .Select(m => m.ToDropMappingCommand(tableName));

            return(dropCommands
                   .Cast <CommandBase>()
                   .Concat(createCommands));
        }
Exemplo n.º 20
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            #region Boilerplate
            IWorkflowContext            context        = executionContext.GetExtension <IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory =
                executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService service =
                serviceFactory.CreateOrganizationService(context.UserId);

            var tracing = executionContext.GetExtension <ITracingService>();
            #endregion

            var  entityIdString = EntityId.Get(executionContext);
            Guid entityId       = Guid.Empty;

            if (!Guid.TryParse(entityIdString, out entityId))
            {
                Succeeded.Set(executionContext, false);
                ErrorMessage.Set(executionContext, $"Guid {entityIdString} is not a valid GUID.");
                return;
            }

            var teamName = TeamName.Get(executionContext);
            using (var ctx = new XrmServiceContext(service))
            {
                var team = (from t in ctx.CreateQuery <Team>()
                            where t.Name == teamName
                            select t).FirstOrDefault();

                if (team == null)
                {
                    Succeeded.Set(executionContext, false);
                    ErrorMessage.Set(executionContext, $"Team {teamName} not found.");
                    return;
                }

                var logicalName = EntityName.Get(executionContext);
                var reference   = (from r in ctx.CreateQuery(logicalName)
                                   where (Guid)r[$"{logicalName}id"] == entityId
                                   select r).FirstOrDefault();

                if (reference == null)
                {
                    Succeeded.Set(executionContext, false);
                    ErrorMessage.Set(executionContext, $"Entity Reference with logical name {logicalName} and id {entityIdString} wasn't found.");
                    return;
                }

                //Assign otherwise
                var assignRequest = new AssignRequest()
                {
                    Assignee = team.ToEntityReference(),
                    Target   = reference.ToEntityReference()
                };
                service.Execute(assignRequest);
            }


            Succeeded.Set(executionContext, true);
        }
Exemplo n.º 21
0
        public void ShouldBeAbleToRecognizeTheDifferentEntities2()
        {
            var model = new RecognitionModel();

            model.AddEntity("DRIVER_LICENSE", "driver license");
            model.AddEntity("nato", "alpha");
            model.AddEntity("nato", "bravo");
            model.AddEntity("nato", "charlie");
            model.AddEntity("digit", "1");
            model.AddEntity("digit", "2");
            model.AddEntity("digit", "3");
            model.AddEntity("digit", "4");
            model.AddEntity("digit", "5");
            model.AddEntity("digit", "6");
            model.AddEntity("digit", "7");
            model.AddEntity("digit", "8");
            model.AddEntity("digit", "9");
            model.AddEntity("digit", "0");
            model.AddEntity("state", "New York");

            var result = model.Recognize("Check driver license New York 1 2 alpha bravo 5 6");

            result.Entities.Should().Equal(
                RecognizedEntity.ByCanonicalForm(EntityName.Value("DRIVER_LICENSE"), EntityForm.Value("driver license")),
                RecognizedEntity.ByCanonicalForm(EntityName.Value("state"), EntityForm.Value("New York")),
                RecognizedEntity.ByCanonicalForm(EntityName.Value("digit"), EntityForm.Value("1")),
                RecognizedEntity.ByCanonicalForm(EntityName.Value("digit"), EntityForm.Value("2")),
                RecognizedEntity.ByCanonicalForm(EntityName.Value("nato"), EntityForm.Value("alpha")),
                RecognizedEntity.ByCanonicalForm(EntityName.Value("nato"), EntityForm.Value("bravo")),
                RecognizedEntity.ByCanonicalForm(EntityName.Value("digit"), EntityForm.Value("5")),
                RecognizedEntity.ByCanonicalForm(EntityName.Value("digit"), EntityForm.Value("6")));
        }
Exemplo n.º 22
0
        private void AddUpdateMethodWithOverload()
        {
            var properties = GetPropertiesForComparison(EntityName);

            if (properties.Count() == 0)
            {
                Pass.Builder.BuilderWarning(Pass.BuildSection.ToString(), GetWarningMessage());
                return;
            }

            var equalityString = GetEqualityString(properties);
            var propertiesList = string.Join(", ", properties);

            Add(Tab(2), string.Format("public IServiceResponse<{0}, IBedrockEntity> Update{0}({0} {1}, bool isUpdateChildren, bool isAddChildren, bool isDeleteChildren)", EntityName, EntityName.LowerCaseFirstCharacter()));
            Add(Tab(2), "{");
            Add(Tab(3), string.Format("if({0} == null)", EntityName.LowerCaseFirstCharacter()));
            Add(Tab(4), string.Format("throw new ArgumentNullException(\"{0}\");", EntityName.LowerCaseFirstCharacter()), NewLine());
            Add(Tab(3), string.Format("var existing{0} = Context.{1}.FirstOrDefault(e => {2});", EntityName, EntityNamePluralized, equalityString), NewLine());
            Add(Tab(3), string.Format("if(existing{0} == null)", EntityName));
            Add(Tab(4), string.Format("throw new KeyNotFoundException(\"No {0} found for key(s) {1}\");", EntityName, propertiesList), NewLine());
            Add(Tab(3), string.Format("existing{0}.Update({1}, isUpdateChildren, isAddChildren, isDeleteChildren);", EntityName, EntityName.LowerCaseFirstCharacter()));
            Add(Tab(3), string.Format("Context.{0}.Update(existing{1});", EntityNamePluralized, EntityName), NewLine());
            Add(Tab(3), string.Format("return Response<{0}, IBedrockEntity>(existing{0});", EntityName));
            Add(Tab(2), "}", NewLine());
        }
Exemplo n.º 23
0
        private void SubstituteParams(IList <EntityName> p)
        {
            for (int i = 0; i < p.Count; i++)
            {
                EntityName paramName = null;

                try
                {
                    string[] values = p[i].PathName.Split('.');
                    foreach (RenamedBase item in SearchItemNew(values))
                    {
                        paramName = item.Name.NameOld;
                    }
                }
                catch { }

                if (paramName == null)
                {
                    foreach (RenamedClass item in SearchClassNoNs(p[i].Name))
                    {
                        paramName = item.Name.NameOld;
                    }
                }

                if (paramName != null)
                {
                    p[i] = paramName;
                }
            }
        }
Exemplo n.º 24
0
        public IActionResult ExportToExcel([FromBody] SearchFormDto form)
        {
            var memoryStream = _service.ExportToExcel(form);

            return(File(memoryStream, "application/vnd.ms-excel",
                        $"Export {EntityName.Pluralize()} {DateTime.Now.ToString("dd.MM.yy HH.mm")}.xlsx"));
        }
Exemplo n.º 25
0
 public void VerifyFormat()
 {
     if (String.IsNullOrEmpty(EntityName.Trim()))
     {
         throw new EntityManagementException(MessagesExceptions.ErrorIsEmpty);
     }
 }
        private string GetJsIntellisenseOptionSet()
        {
            var intellisense = string.Empty;

            intellisense += $"\t{EntityName.ToLower()}.OptionSet = {{}};\r\n";
            foreach (var crmAttribute in Fields)
            {
                if (!crmAttribute.IsValidForRead)
                {
                    continue;
                }
                if (crmAttribute.FieldType == AttributeTypeCode.Picklist ||
                    crmAttribute.FieldType == AttributeTypeCode.State ||
                    crmAttribute.FieldType == AttributeTypeCode.Status)
                {
                    intellisense += $"\t///<field name=\"{crmAttribute.SchemaName}\" type=\"PickList\"></field>\r\n";
                    intellisense += $"\t{EntityName.ToLower()}.OptionSet.{crmAttribute.SchemaName} = {{\r\n";
                    foreach (string nvc in crmAttribute.OptionSetValues)
                    {
                        intellisense +=
                            $"\t\t///<field name=\"{nvc}\" type=\"PickListValue\">{nvc} = {crmAttribute.OptionSetValues[nvc]}</field>\r\n";
                        intellisense += $"\t\t{nvc}: {crmAttribute.OptionSetValues[nvc]},\r\n";
                    }

                    intellisense  = intellisense.TrimEnd(",\r\n".ToCharArray()) + "\r\n";
                    intellisense += $"\t}};\r\n";
                }
            }

            return(intellisense);
        }
Exemplo n.º 27
0
        public override bool IsExcluded(EntityName item)
        {
            var schema = item as Schema;

            if (schema != null)
            {
                return(SchemaFilters.Any(filter => filter.IsExcluded(schema)));
            }

            var table = item as Table;

            if (table != null)
            {
                return(TableFilters.Any(filter => filter.IsExcluded(table)) || SchemaFilters.Any(filter => filter.IsExcluded(table.Schema)));
            }

            var column = item as Column;

            if (column != null)
            {
                return(ColumnFilters.Any(filter => filter.IsExcluded(column)));
            }

            var sp = item as StoredProcedure;

            if (sp != null)
            {
                return(StoredProcedureFilters.Any(filter => filter.IsExcluded(sp)) || SchemaFilters.Any(filter => filter.IsExcluded(sp.Schema)));
            }

            return(false);
        }
 public string ToCsv()
 {
     return(string.Join(",",
                        //AssemblyId.ToString().FormatForCsv(),
                        AssemblyName.FormatForCsv(),
                        //PluginTypeId.ToString().FormatForCsv(),
                        PluginTypeName, StepId.ToString().FormatForCsv(),
                        StepName.FormatForCsv(),
                        FormatForCsv(ImageId),
                        ImageName.FormatForCsv(),
                        Environment.FormatForCsv(),
                        GetStateText(Environment == "Source" ? "target": "source").FormatForCsv(),
                        StepMessageName.FormatForCsv(),
                        EntityName.FormatForCsv(),
                        StepFilteringAttributes.FormatForCsv(),
                        FormatForCsv(RunAsUserId),
                        RunAsUserName.FormatForCsv(),
                        StepRank.ToString().FormatForCsv(),
                        StepDescription.FormatForCsv(),
                        StepStageName.FormatForCsv(),
                        StepModeName.FormatForCsv(),
                        StepSupportedDeploymentName.FormatForCsv(),
                        StepAsyncAutoDelete.ToString(),
                        StepConfiguration.FormatForCsv(),
                        StepSecureConfiguration.FormatForCsv(),
                        ImageAttributes.FormatForCsv()
                        ));
 }
Exemplo n.º 29
0
        public Form1()
        {
            InitializeComponent();
            //if (!File.Exists(cachePath))
            //{
            //    File.Create(cachePath).Close();
            //}
            //using (Stream stream = new FileStream(cachePath,FileMode.Open))
            //{
            //    StreamReader reader = new StreamReader(stream);

            //}
            SetBatchLocation.Hide();
            PathOfBatch.Hide();
            EntityName.Hide();
            EntityNameLabel.Hide();
            positionDic = new Dictionary <PanePosition, string>();
            positionDic.Add(PanePosition.Bottom, "_Down_Frame");
            positionDic.Add(PanePosition.BottomLeft, "_Down_Left_Frame");
            positionDic.Add(PanePosition.BottomRight, "_Down_Right_Frame");
            positionDic.Add(PanePosition.BottomWalled, "_Down_Single_Frame");
            positionDic.Add(PanePosition.Center, "_Middle_Frame");
            positionDic.Add(PanePosition.CenterFull, "_Full_Frame");
            positionDic.Add(PanePosition.CenterWalledHorizontal, "_Horizontal_Middle_Single_Frame");
            positionDic.Add(PanePosition.Left, "_Left_Frame");
            positionDic.Add(PanePosition.Right, "_Right_Frame");
            positionDic.Add(PanePosition.CenterWalledVertical, "_Vertical_Middle_Single_Frame");
            positionDic.Add(PanePosition.TopLeft, "_Top_Left_Frame");
            positionDic.Add(PanePosition.TopRight, "_Top_Right_Frame");
            positionDic.Add(PanePosition.TopWalled, "_Top_Single_Frame");
            positionDic.Add(PanePosition.RightWalled, "_Right_Single_Frame");
            positionDic.Add(PanePosition.LeftWalled, "_Left_Single_Frame");
            positionDic.Add(PanePosition.Top, "_Top_Frame");
        }
        public static EntityName ParseParam(string nameOld)
        {
            int modifierIndex = nameOld.Length - 1;

            do
            {
                if (nameOld[modifierIndex] == '&' || nameOld[modifierIndex] == '*')
                {
                    modifierIndex--;
                }
                else if (modifierIndex > 0 && nameOld.Length > 1 && (nameOld[modifierIndex] == ']' || nameOld[modifierIndex - 1] == '['))
                {
                    modifierIndex -= 2;
                }
                else
                {
                    break;
                }
            }while (true);

            modifierIndex++; // return to first mod's index
            string modifier = null;

            if (modifierIndex < nameOld.Length)
            {
                modifier = nameOld.Substring(modifierIndex);
                nameOld  = nameOld.Substring(0, modifierIndex);
            }

            EntityName result = new EntityName(nameOld);

            result.Modifier = modifier;
            return(result);
        }
Exemplo n.º 31
0
 public Entity(EntityName enName, Game game, GraphicsDeviceManager graphics)
 {
     this.enName = enName;
     if (enName != EntityName.Empty)
     {
         isUsed = true;
     }
 }
    public static string SimplifyType(EntityName value, bool fullName)
    {
      if (Configs.Instance.SimplifySystemNames && (string.IsNullOrEmpty(value.Namespace) || value.Namespace == "System"))
      {
        string result = TryReplace(value.Name);
        if (result != null)
          return result;
      }

      return fullName ? value.PathName : value.Name;
    }
Exemplo n.º 33
0
 public EntityCreatedEvent(Guid aggregateIdentity, Guid metadataDefinitionGroupIdentity, EntityName name)
     : base(aggregateIdentity)
 {
     Name = name;
     MetadataDefinitionGroupIdentity = metadataDefinitionGroupIdentity;
 }
Exemplo n.º 34
0
 public ReLabelEntityCommand(Guid aggregateIdentity, EntityName name)
 {
     AggregateIdentity = aggregateIdentity;
     Name = name;
 }
Exemplo n.º 35
0
 public EntityRenamedEvent(Guid aggregateIdentity, EntityName name)
     : base(aggregateIdentity)
 {
     Name = name;
 }
Exemplo n.º 36
0
 public Renamed(EntityName nameOld, EntityName nameNew)
 {
   this.nameOld = nameOld;
   this.nameNew = nameNew;
 }
Exemplo n.º 37
0
 public Renamed(EntityName nameOld)
 {
   this.nameOld = nameOld;
   nameNew = (EntityName)nameOld.Clone();
 }
Exemplo n.º 38
0
 public Renamed(Renamed nameOld, EntityName nameNew)
 {
   this.nameNew = nameNew;
   this.nameOld = nameOld.nameOld;
 }