Exemplo n.º 1
0
 public void CheckSemantics(IDslModel existingConcepts)
 {
     if (!(Dependency_ImplementationView is ExtensibleSubtypeSqlViewInfo))
     {
         throw new DslSyntaxException(this, "This concept cannot be used together with '" + Dependency_ImplementationView.GetUserDescription()
                                      + "'. Use either " + ConceptInfoHelper.GetKeywordOrTypeName(typeof(SubtypeImplementsPropertyInfo)) + " or " + Dependency_ImplementationView.GetKeywordOrTypeName() + ".");
     }
 }
Exemplo n.º 2
0
 public void CheckSemantics(IDslModel existingConcepts)
 {
     if (!(PropertyInfo.DataStructure is BrowseDataStructureInfo))
     {
         throw new DslSyntaxException($"'{this.GetKeywordOrTypeName()}' cannot be used" +
                                      $" on {PropertyInfo.DataStructure.GetKeywordOrTypeName()} ({PropertyInfo.GetUserDescription()})." +
                                      $" It may only be used on {ConceptInfoHelper.GetKeywordOrTypeName(typeof(BrowseDataStructureInfo))}.");
     }
 }
Exemplo n.º 3
0
 public void CheckSemantics(System.Collections.Generic.IEnumerable <IConceptInfo> concepts)
 {
     if (!(PropertyInfo.DataStructure is BrowseDataStructureInfo))
     {
         throw new DslSyntaxException(string.Format(
                                          "'{0}' cannot be use on {1} ({2}). It may only be used on {3}.",
                                          this.GetKeywordOrTypeName(),
                                          PropertyInfo.DataStructure.GetKeywordOrTypeName(),
                                          PropertyInfo.GetUserDescription(),
                                          ConceptInfoHelper.GetKeywordOrTypeName(typeof(BrowseDataStructureInfo))));
     }
 }
Exemplo n.º 4
0
 public void InternalCheck()
 {
     if (!(Target.DataStructure is EntityInfo))
     {
         throw new FrameworkException(string.Format(
                                          "{0} can only be used on properties of {1}. {2} is a member of {3}.",
                                          this.GetKeywordOrTypeName(),
                                          ConceptInfoHelper.GetKeywordOrTypeName(typeof(EntityInfo)),
                                          Target.GetUserDescription(),
                                          Target.DataStructure.GetKeywordOrTypeName()));
     }
 }
Exemplo n.º 5
0
        public void CheckSemantics(IDslModel existingConcepts)
        {
            var properties = existingConcepts.FindByReference <PropertyInfo>(p => p.DataStructure, this);

            var propertyWithoutSelector = properties
                                          .FirstOrDefault(p => !existingConcepts.FindByReference <BrowseFromPropertyInfo>(bfp => bfp.PropertyInfo, p).Any());

            if (propertyWithoutSelector != null)
            {
                throw new DslSyntaxException(
                          string.Format("Browse property {0} does not have a source selected. Probably missing '{1}'.",
                                        propertyWithoutSelector.GetUserDescription(),
                                        ConceptInfoHelper.GetKeywordOrTypeName(typeof(BrowseFromPropertyInfo))));
            }
        }
        public void TestMethod1()
        {
            var ic = new InitializationConcept {
                RhetosVersion = "1.2.3"
            };

            Assert.AreEqual("InitializationConcept '1.2.3'", ic.GetKey());
            Assert.AreEqual("InitializationConcept '1.2.3'", ic.GetShortDescription());
            Assert.AreEqual("InitializationConcept '1.2.3'", ic.GetUserDescription());
            Assert.AreEqual("'1.2.3'", ic.GetKeyProperties());
            Assert.AreEqual("Rhetos.Dsl.InitializationConcept '1.2.3'", ic.GetFullDescription());
            Assert.AreEqual(null, ic.GetKeyword());
            Assert.AreEqual("InitializationConcept", ic.GetKeywordOrTypeName());
            Assert.AreEqual(0, ic.GetDirectDependencies().Count());
            Assert.AreEqual(0, ic.GetAllDependencies().Count());
            Assert.AreEqual("Rhetos.Dsl.InitializationConcept RhetosVersion=1.2.3", ic.GetErrorDescription());

            Assert.AreEqual(null, ConceptInfoHelper.GetKeyword(typeof(InitializationConcept)));
            Assert.AreEqual("InitializationConcept", ConceptInfoHelper.GetKeywordOrTypeName(typeof(InitializationConcept)));
        }
Exemplo n.º 7
0
        public void CheckSemantics(IDslModel existingConcepts)
        {
            if (ReferenceFromMe.DataStructure != Source)
            {
                throw new DslSyntaxException("'" + this.GetUserDescription()
                                             + "' must use a reference property that is a member of it's own data structure. Try using FilterByLinkedItems instead.");
            }

            var availableFilters = existingConcepts.FindByReference <FilterByInfo>(f => f.Source, ReferenceFromMe.Referenced)
                                   .Select(f => f.Parameter).OrderBy(f => f).ToList();

            if (!availableFilters.Contains(Parameter))
            {
                throw new DslSyntaxException(this, string.Format(
                                                 "There is no {0} '{1}' on {2}. Available {0} filters are: {3}.",
                                                 ConceptInfoHelper.GetKeywordOrTypeName(typeof(FilterByInfo)),
                                                 Parameter,
                                                 ReferenceFromMe.Referenced.GetUserDescription(),
                                                 string.Join(", ", availableFilters.Select(parameter => "'" + parameter + "'"))));
            }
        }
        public static string SignatureDescription(Type type)
        {
            var keys       = new List <string>();
            var parameters = new List <string>();

            foreach (var member in GetParameters(type))
            {
                if (member.IsKey)
                {
                    keys.Add(ConceptMemberDescription(member));
                }
                else
                {
                    parameters.Add(ConceptMemberDescription(member));
                }
            }

            var keyword   = ConceptInfoHelper.GetKeywordOrTypeName(type);
            var keysDesc  = string.Join(".", keys.Select(key => $"<{key}>"));
            var paramDesc = string.Join(" ", parameters.Select(parameter => $"<{parameter}>"));

            return($"{keyword} {keysDesc} {paramDesc}");
        }
Exemplo n.º 9
0
        public void CheckSemantics(IDslModel concepts)
        {
            if (Module.Name != Source.Module.Name)
            {
                throw new DslSyntaxException(
                          string.Format("Browse should be created in same module as referenced entity. Expecting {0} instead of {1}.",
                                        Source.Module,
                                        Module));
            }

            var properties = concepts.FindByReference <PropertyInfo>(p => p.DataStructure, this);

            var propertyWithoutSelector = properties
                                          .Where(p => concepts.FindByReference <BrowseFromPropertyInfo>(bfp => bfp.PropertyInfo, p).Count() == 0)
                                          .FirstOrDefault();

            if (propertyWithoutSelector != null)
            {
                throw new DslSyntaxException(
                          string.Format("Browse property {0} does not have a source selected. Probably missing '{1}'.",
                                        propertyWithoutSelector.GetUserDescription(),
                                        ConceptInfoHelper.GetKeywordOrTypeName(typeof(BrowseFromPropertyInfo))));
            }
        }