public List <T> ToObject <T>(Transaction.Transaction repository)
        {
            var tType        = typeof(T).GetActualType();
            var baseListType = typeof(List <>);
            var listType     = baseListType.MakeGenericType(tType);
            var iList        = listType.CreateInstance() as IList;

            foreach (var item in this)
            {
                var tItem = item.ToObject(tType);
                iList?.Add(tItem);
                if (tItem.GetPrimaryKey() != null && (!repository?.IsAttached(tItem) ?? true))
                {
                    repository?.Attach(tItem);
                }
            }
            return((List <T>)iList);
        }
Exemple #2
0
        public IList ToObject(Type type, Transaction.Transaction repository = null)
        {
            var tType        = type.GetActualType();
            var baseListType = typeof(List <>);
            var listType     = baseListType.MakeGenericType(tType);
            var iList        = Activator.CreateInstance(listType) as IList;

            foreach (var item in this)
            {
                var tItem = item.ToObject(tType);
                iList?.Add(tItem);
                if (!repository?.IsAttached(tItem) ?? true)
                {
                    repository?.Attach(tItem);
                }
            }
            return(iList);
        }
Exemple #3
0
 public DbSchema(Transaction.Transaction repository)
 {
     _repository = repository;
 }