public namespace_map GetOrCreateOldNSMap(int sdkId, string ns) { var query = from nm in dbConnection.namespace_map where nm.sdk_id == sdkId && nm.old_namespace == ns select nm; if (query.Any()) { return(query.First()); } else { namespace_map nsMap = new namespace_map { sdk_id = sdkId, old_namespace = ns }; dbConnection.namespace_map.Add(nsMap); try { dbConnection.SaveChanges(); } catch (Exception) { //Do nothing } return(nsMap); } }
public void UpdateOrCreateNSMapping(namespace_map nsMap, sdk_map2 sdkMap, string newNS) { var query = from nm in dbConnection.namespace_map where nm.sdk_id == nsMap.sdk_id && nm.old_namespace == nsMap.old_namespace && nm.new_namespace == newNS select nm; if (!query.Any()) { query = from nm in dbConnection.namespace_map where nm.sdk_id == nsMap.sdk_id && nm.old_namespace == nsMap.old_namespace && nm.new_namespace == null select nm; if (!query.Any()) { namespace_map splitNsMap = new namespace_map { sdk_id = nsMap.sdk_id, old_namespace = nsMap.old_namespace, new_namespace = newNS }; sdkMap.namespace_map_id = 0; sdkMap.namespace_map = splitNsMap; } else { nsMap.new_namespace = newNS; } } 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 } }