Exemple #1
0
        private ComplexTypeMaterializer.Plan GetPlan(DataRecordInfo recordInfo)
        {
            ComplexTypeMaterializer.Plan[] planArray = this._lastPlans ?? (this._lastPlans = new ComplexTypeMaterializer.Plan[4]);
            int index1 = this._lastPlanIndex - 1;

            for (int index2 = 0; index2 < 4; ++index2)
            {
                index1 = (index1 + 1) % 4;
                if (planArray[index1] != null)
                {
                    if (planArray[index1].Key == recordInfo.RecordType)
                    {
                        this._lastPlanIndex = index1;
                        return(planArray[index1]);
                    }
                }
                else
                {
                    break;
                }
            }
            ObjectTypeMapping objectMapping = Util.GetObjectMapping(recordInfo.RecordType.EdmType, this._workspace);

            this._lastPlanIndex = index1;
            planArray[index1]   = new ComplexTypeMaterializer.Plan(recordInfo.RecordType, objectMapping, recordInfo.FieldMetadata);
            return(planArray[index1]);
        }
Exemple #2
0
 internal object CreateComplex(
     IExtendedDataRecord record,
     DataRecordInfo recordInfo,
     object result)
 {
     ComplexTypeMaterializer.Plan plan = this.GetPlan(recordInfo);
     if (result == null)
     {
         result = plan.ClrType();
     }
     this.SetProperties(record, result, plan.Properties);
     return(result);
 }