public assembly_map GetOrCreateOldAssemblyMap(int sdkId, string dllPath) { var query = from am in dbConnection.assembly_map where am.sdk_id == sdkId && am.old_path == dllPath select am; if (query.Any()) { return(query.First()); } else { assembly_map asMap = new assembly_map { sdk_id = sdkId, old_path = dllPath }; dbConnection.assembly_map.Add(asMap); try { dbConnection.SaveChanges(); } catch (Exception) { //Do nothing } return(asMap); } }
public void UpdateAssemblyMapping(assembly_map asMap, sdk_map2 sdkMap, string dllPath, string assemFullName) { var query = from nm in dbConnection.assembly_map where nm.sdk_id == asMap.sdk_id && nm.old_path == asMap.old_path && nm.new_path == dllPath select nm; if (!query.Any()) { query = from nm in dbConnection.assembly_map where nm.sdk_id == asMap.sdk_id && nm.old_path == asMap.old_path && nm.new_path == null select nm; if (!query.Any()) { assembly_map splitAsMap = new assembly_map { sdk_id = asMap.sdk_id, old_path = asMap.old_path, new_path = dllPath, name = assemFullName }; sdkMap.assembly_map_id = 0; sdkMap.assembly_map = splitAsMap; } else { asMap.new_path = dllPath; asMap.name = assemFullName; } } try { dbConnection.SaveChanges(); } catch (Exception) { //Do nothing } }
public void SaveOldSDKMapping(int sdkId, string modelIdentifier, string className, namespace_map nsMap, assembly_map asMap) { sdk_map2 sdkMap = new sdk_map2 { model_identifier = modelIdentifier, old_classname = className, sdk_id = sdkId, namespace_map_id = nsMap.id, assembly_map_id = asMap.id }; dbConnection.sdk_map2.Add(sdkMap); try { dbConnection.SaveChanges(); } catch (Exception) { //Do nothing } }