void SetupDataStore(DataSetDataStore dataSetDataStore, UnitOfWork unitOfWork, ITypeInfo typeInfo) {
     var classType = FindMappedTypeInfo(typeInfo.Name).Type;
     dataSetDataStore.ObjectClassInfo = unitOfWork.Dictionary.GetClassInfo(classType);
     dataSetDataStore.DynamicTypeInfo = typeInfo;
     Activator.CreateInstance(classType, unitOfWork);
     unitOfWork.CommitChanges();
     unitOfWork.GetObjects(dataSetDataStore.ObjectClassInfo, null, new SortingCollection(), 0, 0, false, true);
 }
Exemple #2
0
        void SetupDataStore(DataSetDataStore dataSetDataStore, UnitOfWork unitOfWork, ITypeInfo typeInfo)
        {
            var classType = FindMappedTypeInfo(typeInfo.Name).Type;

            dataSetDataStore.ObjectClassInfo = unitOfWork.Dictionary.GetClassInfo(classType);
            dataSetDataStore.DynamicTypeInfo = typeInfo;
            classType.CreateInstance(unitOfWork);
            unitOfWork.CommitChanges();
            unitOfWork.GetObjects(dataSetDataStore.ObjectClassInfo, null, new SortingCollection(), 0, 0, false, true);
        }
 public Dictionary<ITypeInfo, string> GenerateSql(ISqlGeneratorFormatter sqlGeneratorFormatter, IList<ITypeInfo> typeInfos) {
     var dictionary = new Dictionary<ITypeInfo, string>();
     var dataSetDataStore = new DataSetDataStore();
     var unitOfWork = new UnitOfWork(new SimpleDataLayer(_typeHelper.XPDictionary, dataSetDataStore));
     foreach (var typeInfo in typeInfos) {
         SetupDataStore(dataSetDataStore, unitOfWork, typeInfo);
         var sql = new SelectSqlGenerator(sqlGeneratorFormatter).GenerateSql(dataSetDataStore.SelectStatement).Sql;
         sql = ParseSql(sql);
         dictionary.Add(typeInfo, sql);
     }
     return dictionary;
 }
Exemple #4
0
        public Dictionary <ITypeInfo, string> GenerateSql(ISqlGeneratorFormatter sqlGeneratorFormatter, IList <ITypeInfo> typeInfos)
        {
            var dictionary       = new Dictionary <ITypeInfo, string>();
            var dataSetDataStore = new DataSetDataStore();
            var unitOfWork       = new UnitOfWork(new SimpleDataLayer(_typeHelper.XPDictionary, dataSetDataStore));

            foreach (var typeInfo in typeInfos)
            {
                SetupDataStore(dataSetDataStore, unitOfWork, typeInfo);
                var sql = new SelectSqlGenerator(sqlGeneratorFormatter).GenerateSql(dataSetDataStore.SelectStatement).Sql;
                sql = ParseSql(sql);
                dictionary.Add(typeInfo, sql);
            }
            return(dictionary);
        }