public static void LoadSqlData(IObjectProxy proxy, System.Data.DataRow row, SqlCon con, Context.ICurrentContextFactory conFac) { if (proxy != null && proxy.Model.ModelType != ModelType.Enum) { foreach (var property in proxy.Model.Properties.Where(p => p.IsArray == false && (string.IsNullOrEmpty(p.DBName) == false || p.IsMultiMap == true))) { dynamic propertyOb = null; if (property.PropertyType == PropertyType.RadomDECS) { propertyOb = EncryptionClass.GetDecrptyString(property, row); } else if (property.PropertyType != PropertyType.BusinessObject) { if (String.IsNullOrEmpty((property.DBName ?? "").Trim()) == false && row.Table.Columns.Contains(property.DBName) == true && row[property.DBName] != DBNull.Value) { propertyOb = row[property.DBName]; } else { propertyOb = GetDefaultValue(property); } } else { IObjectProxy tempProxy = null;/// new SqlDataProxy(property.Model,conFac, LoadType.Null,con); if (property.IsMultiMap == false) { if (String.IsNullOrEmpty(property.DBName) == false && row[property.DBName] != DBNull.Value) { tempProxy = getProxy(property.Model, row[property.DBName], con, conFac); } else { tempProxy = null; } } else { var modelKeyProperty = property.Model.IdProperty; if (modelKeyProperty != null) { var itemKeyProperrty = property.DBMaps.FirstOrDefault(p => p.PropertyName == modelKeyProperty.PropertyName); if (itemKeyProperrty != null) { var rowOb = row[itemKeyProperrty.DBColName]; if (rowOb != DBNull.Value) { tempProxy = getProxy(property.Model, rowOb, con, conFac); tempProxy.IsLoad = LoadType.Null; } } } bool IsSet = false; foreach (var map in property.DBMaps) { var rowOb = row[map.DBColName]; if (rowOb != DBNull.Value) { tempProxy[tempProxy.Model.Properties.First(p => p.Name == map.PropertyName || p.PropertyName == map.PropertyName)] = rowOb; IsSet = true; } } if (IsSet == false) { tempProxy = null; } else { tempProxy.IsLoad = LoadType.Partial; } } propertyOb = tempProxy; } proxy[property] = propertyOb; proxy.UpdateToNew(property); } } if (proxy.ID == null || (proxy.ID is long && System.Convert.ToInt64(proxy.ID) == 0)) { if (proxy.Model.AutoSysId == false && proxy.Model.IdProperty != null) { proxy.ID = proxy[proxy.Model.IdProperty]; } else { proxy.ID = row["SysId"]; } } MemoryCache.StoreDbCache.UpdateOrAddDbMemoryCache(con, proxy.Model, proxy.ID, proxy); // System.Diagnostics.Trace.WriteLine( "Id:" + proxy.ID); }