Dev2.DynamicServices.Source.Compile C# (CSharp) Method

Compile() public method

Validates the Source to ensure integrity before the source is added to the dynamic service engine
public Compile ( ) : bool
return bool
        public override bool Compile()
        {
            base.Compile();

            switch (Type)
            {
                case enSourceType.SqlDatabase:
                    if (string.IsNullOrEmpty(ConnectionString))
                    {
                        WriteCompileError(Resources.CompilerError_MissingConnectionString);
                    }
                    break;

                case enSourceType.WebService:
                    if (WebServiceUri == null)
                    {
                        WriteCompileError(Resources.CompilerError_MissingUri);
                    }
                    else
                    {
                        if (!Uri.IsWellFormedUriString(WebServiceUri.ToString(), UriKind.RelativeOrAbsolute))
                        {
                            WriteCompileError(Resources.CompilerError_InvalidUri);
                        }
                        else
                        {
                            try
                            {
                                Invoker = new WebServiceInvoker(WebServiceUri);
                            }
                            catch (Exception ex)
                            {
                                string data = string.Format("<{0}>{1}\r\nDetail:\r\n{2}</{0}>", "CompilerError",
                                    "Unable to generate Web Service Proxy", ex.Message);
                                WriteCompileError(data);
                            }
                        }
                    }

                    break;

                case enSourceType.Plugin:
                    if (string.IsNullOrEmpty(AssemblyName))
                    {
                        WriteCompileError(Resources.CompilerError_MissingAssemblyName);
                    }

                    if (string.IsNullOrEmpty(AssemblyLocation))
                    {
                        WriteCompileError(Resources.CompilerError_MissingAssemblyLocation);
                    }
                    break;

                case enSourceType.Unknown:
                    WriteCompileError(Resources.CompilerError_InvalidSourceType);
                    break;
            }

            return IsCompiled;
        }
    }