Beispiel #1
0
        public void Resolve(DcSpace space)
        {
            if (!string.IsNullOrEmpty(SchemaName))
            {
                // 1. Resolve schema name
                TypeSchema = space.GetSchema(SchemaName);
                if (TypeSchema == null)
                {
                    return;                     // Cannot resolve
                }
                // 2. Resolve table name
                TypeTable = TypeSchema.GetSubTable(TypeName);
                if (TypeTable == null)
                {
                    return;                    // Cannot resolve
                }
            }
            else if (!string.IsNullOrEmpty(TypeName)) // No schema name (imcomplete info)
            {
                // 1. try to find the table in the mashup
                DcSchema mashup = space.GetSchemas().FirstOrDefault(x => x.GetSchemaKind() == DcSchemaKind.Dc);
                if (mashup != null)
                {
                    TypeTable = mashup.GetSubTable(TypeName);
                    if (TypeTable != null)
                    {
                        TypeSchema = mashup;
                        SchemaName = TypeSchema.Name; // We also reconstruct the name
                        return;
                    }
                }

                // 2. try to find the table in any other schema
                foreach (DcSchema schema in space.GetSchemas())
                {
                    TypeTable = schema.GetSubTable(TypeName);
                    if (TypeTable != null)
                    {
                        TypeSchema = schema;
                        SchemaName = TypeSchema.Name; // We also reconstruct the name
                        return;
                    }
                }
            }
        }