Beispiel #1
0
        public T Load(T obj, string[] primaryKeyNames, int langId)
        {
            Type     t       = typeof(T);
            IFactory factory = DBHelper.CreateFactory();

            try
            {
                obj = dal.Load(obj, primaryKeyNames, factory);
                string[] fields = { "MainId", "LangId" };


                PropertyInfo property = t.GetProperty(("Id"));
                int          id       = Convert.ToInt32(property.GetValue(obj, null));
                TDesc        objDesc  = dalDesc.LoadByObjectAndLang(id, langId, factory);
                property = t.GetProperty(Utils.GetPropertyDescName(typeof(TDesc)));
                property.SetValue(obj, objDesc, null);
            }
            catch (Exception ex)
            {
                Write2Log.WriteLogs("Generic2C<T, TDesc>", string.Format("Load({0} obj, string[] primaryKeyNames, int langId, out TDesc objDesc)", t.Name), ex.Message);
            }
            finally
            {
                factory.Release();
            }
            return(obj);
        }