예제 #1
0
        public Boolean SaveSDKMappings(List <Mapping> mappings, int sdk_id)
        {
            List <sdk_map> dbMappings = new List <sdk_map>();

            foreach (var m in mappings)
            {
                sdk_map dbMapping = new sdk_map
                {
                    model_identifier  = m.ModelIdentifierGUID,
                    old_namespace     = m.OldNamespace,
                    old_classname     = m.OldClassName,
                    old_assembly_path = m.OldDllPath,
                    new_namespace     = m.NewNamespace,
                    new_classname     = m.NewClassName,
                    new_assembly_path = m.NewDllPath,
                    sdk_id            = sdk_id
                };
                dbMappings.Add(dbMapping);
            }
            dbConnection.sdk_maps.InsertAllOnSubmit(dbMappings);

            try
            {
                dbConnection.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
            return(true);
        }
예제 #2
0
        public Boolean SaveSDKMappings(List <GenericMapping> oldMappingsToSave, List <GenericMapping> newMappingsToSave, int sdk_id)
        {
            List <sdk_map> dbMappings = new List <sdk_map>();

            foreach (var m in oldMappingsToSave)
            {
                sdk_map dbMapping = new sdk_map
                {
                    model_identifier  = m.ModelIdentifierGUID,
                    old_namespace     = m.Namespace,
                    old_classname     = m.ClassName,
                    old_assembly_path = m.DllPath,
                    sdk_id            = m.SdkId
                };
                dbMappings.Add(dbMapping);
            }
            dbConnection.sdk_maps.InsertAllOnSubmit(dbMappings);

            try
            {
                dbConnection.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }

            List <String> ids   = oldMappingsToSave.Select(m => m.ModelIdentifierGUID).ToList();
            var           query = from sm in dbConnection.sdk_maps
                                  where ids.Contains(sm.model_identifier) && sm.sdk_id == sdk_id
                                  select sm;

            foreach (sdk_map dbMapping in query)
            {
                var mapping = newMappingsToSave.Where(mts => mts.ModelIdentifierGUID == dbMapping.model_identifier).First();
                dbMapping.new_classname     = mapping.ClassName;
                dbMapping.new_namespace     = mapping.Namespace;
                dbMapping.new_assembly_path = mapping.DllPath;
            }

            try
            {
                dbConnection.SubmitChanges();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
예제 #3
0
        private Mapping GetByWhereClause(Expression <Func <sdk_map, bool> > whereClause)
        {
            var res = dbConnection.sdk_maps.Where(whereClause);

            try
            {
                sdk_map row     = res.Single();
                Mapping mapping = new Mapping(row.old_namespace, row.new_namespace, row.model_identifier, row.old_classname, row.new_classname, row.old_assembly_path, row.new_assembly_path);
                return(mapping);
            } catch (Exception)
            {
                //Do nothing
            }
            return(null);
        }
 partial void Deletesdk_map(sdk_map instance);
 partial void Updatesdk_map(sdk_map instance);
 partial void Insertsdk_map(sdk_map instance);
 private void detach_sdk_maps(sdk_map entity)
 {
     this.SendPropertyChanging();
     entity.sdk = null;
 }
 private void attach_sdk_maps(sdk_map entity)
 {
     this.SendPropertyChanging();
     entity.sdk = this;
 }