Ejemplo n.º 1
0
            public FunctionGenerator(EmissionsGenerator egen, TypeBuilder dcType, SchemaObject funcInfo, string methodName, MethodAttributes accessibility)
            {
                Type resultType;

                this.EGen         = egen;
                this.DCType       = dcType;
                this.FunctionInfo = funcInfo;
                if (funcInfo is TableFunction)
                {
                    this.ResultType = egen._tableTypes[funcInfo.DotNetName];
                }
                else
                {
                    if (funcInfo.ReturnInfo == null)
                    {
                        return;
                    }
                    this.ResultType = funcInfo.ReturnInfo.ClrType;
                }
                if (funcInfo is TableFunction)
                {
                    resultType = typeof(IQueryable <>).MakeGenericType(new Type[] { this.ResultType });
                }
                else
                {
                    resultType = this.ResultType;
                }
                this.Method = dcType.DefineMethod(methodName, accessibility, resultType, (from p in funcInfo.Parameters select p.ClrType).ToArray <Type>());
            }
        public IEnumerable <ExplorerItem> GetSchemaAndBuildAssembly(Repository r, AssemblyName target, string nameSpace, string typeName)
        {
            Database mainSchema = r.IsSqlCE ? new SqlCeSchemaReader().GetDatabase(r) : (r.IsAzure ? new AzureSchemaReader().GetDatabase(r) : new SqlServerSchemaReader().GetDatabase(r));

            EmissionsGenerator.Generate(mainSchema, target, r.GetCxString(), nameSpace, typeName);
            return(mainSchema.GetExplorerSchema(true, null, false));
        }