public void Update(ClientInfo clientInfo) { SyncStatus = Shared.Enum.SyncStatus.Staged; SyncStatusDate = DateTime.Now; IsFamilyMember = clientInfo.IsFamilyMember; IsPartner = clientInfo.IsPartner; MaritalStatus = clientInfo.MaritalStatus; KeyPop = clientInfo.KeyPop; OtherKeyPop = clientInfo.OtherKeyPop; PreventEnroll = clientInfo.PreventEnroll; AlreadyTestedPos = clientInfo.AlreadyTestedPos; UserId = clientInfo.UserId; Identifiers.Clear(); var identifiers = ClientIdentifier.Create(clientInfo); AddIdentifiers(identifiers); Relationships.Clear(); var relationships = ClientRelationship.Create(clientInfo); AddRelationships(relationships); ClientStates.Clear(); var stats = ClientState.Create(clientInfo); AddClientStates(stats); }
public void Dispose() { Log?.Clear(); Entities?.Clear(); Actions?.Clear(); CalculatedFields?.Clear(); Connections?.Clear(); Environments?.Clear(); Maps?.Clear(); Relationships?.Clear(); Scripts?.Clear(); SearchTypes?.Clear(); Templates?.Clear(); }
///-------------------------------------------------------------------------------- /// <summary>This method disposes of resources in the view model.</summary> ///-------------------------------------------------------------------------------- protected override void OnDispose() { if (Relationships != null) { foreach (RelationshipViewModel itemView in Relationships) { itemView.Updated -= Children_Updated; itemView.Dispose(); } Relationships.Clear(); Relationships = null; } Entity = null; base.OnDispose(); }
public void CompressResponse() { if (Nodes == null || Nodes.Count == 0) { return; } MemoryStream nodeCollectionXml = null; MemoryStream compressedNodeCollectionStream = null; ZlibStream zipStream = null; try { nodeCollectionXml = new MemoryStream(); DataContractSerializer serializer = new DataContractSerializer(typeof(CompressedResponseTuple)); CompressedResponseTuple responseTuple = new CompressedResponseTuple(); responseTuple.Nodes = Nodes; responseTuple.Relationships = Relationships; serializer.WriteObject(nodeCollectionXml, responseTuple); byte[] metadataCollectionBytes = nodeCollectionXml.ToArray(); compressedNodeCollectionStream = new MemoryStream(); using (zipStream = new ZlibStream(compressedNodeCollectionStream, CompressionMode.Compress)) { zipStream.Write(metadataCollectionBytes, 0, metadataCollectionBytes.Length); } byte[] compressedMetadataCollectionBytes = compressedNodeCollectionStream.ToArray(); CompressedNodeData = Convert.ToBase64String(compressedMetadataCollectionBytes); Nodes.Clear(); Relationships.Clear(); } finally { if (nodeCollectionXml != null) { nodeCollectionXml.Dispose(); nodeCollectionXml = null; } } }
internal void ResetClient() { Relationships.Clear(); }
protected override void LoadDatabaseRelationships() { if (Relationships == null) { Relationships = new List <DataConnection>(); } Relationships.Clear(); //Foreign key relationships LoadTableRelationships(); LoadTriggerRelationships(); //View, procedure, and function relationships DataTable refdatatable = new DataTable(); using (SqlConnection conn = new SqlConnection(ConnectionStringBuilder.ConnectionString)) { conn.Open(); using (SqlDataAdapter sda = new SqlDataAdapter(DEPENDENCY_QUERY, conn)) { sda.Fill(refdatatable); } conn.Close(); } //start parsing through the data rows string referencing; string referenced; foreach (DataRow refrow in refdatatable.Rows) { referencing = refrow["referencing_entity_name"].ToString(); referenced = refrow["referenced_entity_name"].ToString(); DataSourceNodeBase referrer = Nodes.Where(n => n.ObjectName == referencing).FirstOrDefault(); if (referrer != null) { //We have a start node DataConnection depconn = new DataConnection { ConnectionType = RecordKeys.Dependency, StartNode = null, EndNode = referrer }; if (refrow["referenced_server_name"] == null && refrow["referenced_database_name"] == null) { //Dealing with an internal reference depconn.StartNode = Nodes.Where(n => n.ObjectName == referenced).FirstOrDefault(); } else { //Dealing with an external reference string refserver = refrow["referenced_server_name"] != null ? refrow["referenced_server_name"].ToString() : null; string refdb = refrow["referenced_database_name"] != null ? refrow["referenced_database_name"].ToString() : null; string refschema = refrow["referenced_schema_name"] != null ? refrow["referenced_schema_name"].ToString() : null; string refobj = refrow["referenced_entity_name"].ToString(); List <string> ancestry = new List <string>(); if (!String.IsNullOrEmpty(refserver) && !String.IsNullOrWhiteSpace(refserver)) { //See if such a node exists--if not, create one DataSourceNodeBase servernode = Nodes.Where(n => n.Name == refserver).FirstOrDefault(); if (servernode == null) { servernode = new GenericDataSourceNode(refserver, ConnectionStringBuilder); servernode.ObjectName = refserver; Nodes.Add(servernode); } ancestry.Add(refserver); } if (!String.IsNullOrEmpty(refdb) && !String.IsNullOrWhiteSpace(refdb)) { DataSourceNodeBase dbnode = Nodes.Where(n => n.Name == refdb).FirstOrDefault(); if (dbnode == null) { dbnode = new GenericDataSourceNode(refdb, ConnectionStringBuilder); dbnode.ObjectName = refdb; dbnode.Lineage = CreateNameSpace(ancestry); Nodes.Add(dbnode); } ancestry.Add(refdb); } GenericDataSourceNode extrefnode = new GenericDataSourceNode(refobj, ConnectionStringBuilder); extrefnode.Schema = refschema; extrefnode.ObjectName = refobj; if (ancestry.Count > 0) { extrefnode.Lineage = CreateNameSpace(ancestry); } depconn.StartNode = extrefnode; Nodes.Add(extrefnode); } if (depconn.StartNode != null) { depconn.Name = String.Format("{0} => {1}", depconn.StartNode.ToString(), depconn.EndNode.ToString()); Relationships.Add(depconn); } } } }