parameter in child_fetch

parameter in child_fetch

Old forum URL: forums.lhotka.net/forums/t/8722.aspx


skip0925 posted on Thursday, March 25, 2010

I have a situation where i have to combine data from multiple tables as a collection (private void DataPortal_Fetch())

        private void DataPortal_Fetch(
          SingleCriteria<CellInfos, string> criteria)
        {
            RaiseListChangedEvents = false;
            IsReadOnly = false;
            using (var ctx = ContextManager<DalLinq.WareDataContext>.GetManager(DalLinq.Database.storem))
            {
                var goods = ctx.DataContext.GetTable<DalLinq.Goods>();
                var cell = ctx.DataContext.GetTable<DalLinq.Cell>();
                var palette = ctx.DataContext.GetTable<DalLinq.Palette>();
                var data = from a in palette
                           from b in goods
                           from c in cell
                           where (a.goodsNo == b.goodsNo) && (a.facNo == b.facNo) &&
                                 (a.CellNo == criteria.Value) &&
                                 (c.CellNo == criteria.Value)
                           select new
                           {
                               a.CellNo,
                               a.PaletteID,
                               a.PAID,
                               a.number,
                               a.goodsNo,
                               b.goodsName,
                               b.Alias,
                               c.purpose,
                               a.BatchNo
                           };
                foreach (var value in data)
                    this.Add(CellInfo.GetItem(value));
            }

            IsReadOnly = true;
            RaiseListChangedEvents = true;
        }

and add it to CellInfo.GetItem() class .
However, The contents  of parameter(childData)  in Child_Fetch() can't retrieve in LoadProperty()
I can't figure it out. Please help!!

using System;
using Csla;

namespace WMS.Biz.cellM
{
    [Serializable]
    public class CellInfo : ReadOnlyBase<CellInfo>
    {
        .
 .
 .
        internal static CellInfo GetItem(object childData)
        {
            return DataPortal.FetchChild<CellInfo>(childData);
        }

        private void Child_Fetch(object childData)
        {
            //childData = new newResult();
            //newResult data;
            //data = (newResult)childData;

            //LoadProperty(CellNoProperty, data.CellNo);
            //LoadProperty(CellNoProperty, data.PaletteID);
        }

        .
 .
 .

    }
}

FrazerS replied on Thursday, March 25, 2010

I'm just guessing here, but I would try strongly typing childData.

Frazer

Copyright (c) Marimer LLC