Esempio n. 1
0
        public Type DetermineSystemType()
        {
            if (SystemTypeName.IsNotEmpty() && SystemTypeName.Contains(','))
            {
                return(Type.GetType(SystemTypeName));
            }

            var types = FindSystemTypesInCurrentAssembly();

            if (types.Count() == 1)
            {
                return(types.Single());
            }

            if (SystemTypeName.IsNotEmpty())
            {
                return(types.FirstOrDefault(x => x.Name == SystemTypeName));
            }

            if (!types.Any())
            {
                return(typeof(NulloSystem));
            }


            throw new InDeterminateSystemTypeException(types);
        }
Esempio n. 2
0
        private String GetTypeNameStatement()
        {
            if (SystemTypeName.Equals("decimal") || SystemTypeName.Equals("numeric"))
            {
                return(String.Format("{0}({1},{2})", SystemTypeName, Precision, Scale));
            }

            if (SystemTypeName.Equals("time") || SystemTypeName.Equals("datetimeoffset"))
            {
                return(String.Format("{0}({1})", SystemTypeName, Scale));
            }

            if (SystemTypeName.Equals("varchar") || SystemTypeName.Equals("char") ||
                SystemTypeName.Equals("varbinary") || SystemTypeName.Equals("binary"))
            {
                if (MaxLength < 0)
                {
                    return(String.Format("{0}(max)", SystemTypeName));
                }
                else
                {
                    return(String.Format("{0}({1})", SystemTypeName, MaxLength));
                }
            }

            if (SystemTypeName.Equals("nvarchar") || SystemTypeName.Equals("nchar"))
            {
                if (MaxLength < 0)
                {
                    return(String.Format("{0}(max)", SystemTypeName));
                }
                else
                {
                    return(String.Format("{0}({1})", SystemTypeName, MaxLength / 2));
                }
            }

            if (SystemTypeName.Equals("xml"))
            {
                return("xml");

                /*if (this.IsXmlDocument)
                 * {
                 *  return String.Format("xml (DOCUMENT [{0}].[{1}])", XmlCollectionSchemaName, XmlCollectionName);
                 * }
                 * else
                 * {
                 *  return String.Format("xml (CONTENT [{0}].[{1}])", XmlCollectionSchemaName, XmlCollectionName);
                 * }*/
            }


            return($"[{SystemTypeName}]");
        }
Esempio n. 3
0
        public ProjectValidationMessages Validate()
        {
            var messages = new ProjectValidationMessages();

            if (TestFolder.IsEmpty())
            {
                messages.Messages.Add("Test Folder must be specified");
            }
            else if (!Directory.Exists(GetTestFolder()))
            {
                messages.Messages.Add("Test Folder '{0}' does not exist".ToFormat(GetTestFolder()));
            }

            if (BinaryFolder.IsEmpty())
            {
                messages.Messages.Add("Binary Folder must be specified");
            }
            else if (!Directory.Exists(GetBinaryFolder()))
            {
                messages.Messages.Add("Binary Folder '{0}' does not exist".ToFormat(GetBinaryFolder()));
            }

            if (FixtureAssembly.IsEmpty() && SystemTypeName.IsEmpty())
            {
                messages.Messages.Add("Either Fixture Assembly or System Type Name needs to be specified");
            }

            if (Name.IsEmpty())
            {
                messages.Messages.Add("Name is required");
            }

            if (FileName.IsEmpty())
            {
                messages.Messages.Add("File Name is required");
            }

            return(messages);
        }