private static ClientChannelConfig GetClientChannelConfig([NotNull] string configFilePath) { ClientChannelConfig clientChannelConfig; _msg.DebugFormat("Geometry processing microservice configuration from {0}", configFilePath); try { XmlSerializationHelper <ClientChannelConfigs> configHelper = new XmlSerializationHelper <ClientChannelConfigs>(); clientChannelConfig = configHelper.ReadFromFile(configFilePath).Channels.First(); } catch (Exception e) { _msg.Debug($"Error reading configuration from {configFilePath}.", e); throw new InvalidConfigurationException( $"Error reading geometry processing microservice configuration from {configFilePath}", e); } return(clientChannelConfig); }
private IList <IPolygon> BufferCore([NotNull] IEnumGeometry enumInput, double distance) { // does no longer work as of 9.3.1 (implementing IGeometryCollection is NOT sufficient) // BufferOutput output = new BufferOutput(); if (_properties.EndOption == esriBufferConstructionEndEnum.esriBufferFlat) { ResetCorruptFlatEndEnvironment(); } IGeometryCollection outputCollection = PrepareTemplateBag(); try { try { _construction.ConstructBuffers(enumInput, distance, outputCollection); } catch (Exception) { _msg.DebugFormat( "Error buffering {0} geometries with distance {1}", enumInput.Count, distance); throw; } return(GetOutput(outputCollection)); } finally { ResetTemplateBag(); } }
private void Render(QAVerificationDisplayMode displayMode) { _msg.DebugFormat("Render({0})", displayMode); switch (displayMode) { case QAVerificationDisplayMode.Plain: RenderPlainView(); break; case QAVerificationDisplayMode.Layer: RenderLayerView(); break; case QAVerificationDisplayMode.Hierachric: RenderHierarchicView(); break; case QAVerificationDisplayMode.List: RenderListView(); break; case QAVerificationDisplayMode.ConditionsByCategory: RenderConditionsByCategory(); break; default: throw new ArgumentOutOfRangeException(nameof(displayMode)); } }
public static Plane3D GetSourcePlane([NotNull] IList <Pnt3D> pntList, double coplanarityTolerance, bool warnIfNotPlanar = true) { Plane3D sourcePlane = Plane3D.TryFitPlane(pntList); if (sourcePlane == null) { return(null); } double maxDeviation; string message; bool?coplanar = AreCoplanar( pntList, sourcePlane, coplanarityTolerance, out maxDeviation, out message); if (coplanar == null || !coplanar.Value) { if (warnIfNotPlanar) { _msg.WarnFormat( "Input geometry contains non-coplanar points. The result will not be co-planar either."); } _msg.DebugFormat( "Input points are not planar w.r.t. tolerance {0}: {1}", coplanarityTolerance, StringUtils.Concatenate(pntList, ", ")); } return(sourcePlane); }
protected override void StoreReshapedGeometryCore( IFeature feature, IGeometry newGeometry, NotificationCollection notifications) { if (!HasEndpointChanged(feature, newGeometry)) { base.StoreReshapedGeometryCore(feature, newGeometry, notifications); return; } _msg.DebugFormat("Saving open jaw reshape on network feature {0}...", GdbObjectUtils.ToString(feature)); if (MoveLineEndJunction && NetworkFeatureFinder != null && newGeometry.GeometryType == esriGeometryType.esriGeometryPolyline) { StoreOpenJawReshapeWithEndPointMove(feature, newGeometry, notifications); } else { StoreOpenJawReshape(feature, newGeometry); } }
public static Type LoadType([NotNull] string assemblyName, [NotNull] string typeName, IReadOnlyDictionary <string, string> assemblySubstitutes = null) { Assert.ArgumentNotNullOrEmpty(assemblyName, nameof(assemblyName)); Assert.ArgumentNotNullOrEmpty(typeName, nameof(typeName)); var substitutes = assemblySubstitutes ?? _substitutes; bool throwOnError = !substitutes.TryGetValue(assemblyName, out string subsituteAssembly); Assembly assembly = null; try { AssemblyName name = GetAssemblyName(BinDirectory, assemblyName); if (string.IsNullOrEmpty(name.CodeBase)) { _msg.VerboseDebugFormat("Loading type {0} from {1}", typeName, name); } else { _msg.VerboseDebugFormat("Loading type {0} from {1} (codebase: {2})", typeName, name, name.CodeBase); } assembly = Assembly.Load(name); } catch (Exception e) { _msg.Debug($"Loading {typeName} failed because assembly {assemblyName} from {BinDirectory} could not be loaded.", e); if (throwOnError) { throw; } _msg.DebugFormat("Trying assembly substitute {0}...", subsituteAssembly); assembly = Assembly.Load(subsituteAssembly); } Type type = assembly.GetType(typeName, throwOnError); if (type == null) { string substituteType = typeName.Replace(assemblyName, subsituteAssembly); _msg.Debug( $"Failed loading type {typeName} from {assemblyName}, trying {substituteType} from {subsituteAssembly}"); return(LoadType(Assert.NotNull(subsituteAssembly), substituteType, new Dictionary <string, string>(0))); } return(type); }
public AssociationAttribute AddAttribute([NotNull] string name, FieldType fieldType) { Assert.ArgumentNotNullOrEmpty(name, nameof(name)); foreach (AssociationAttribute existingAttribute in _attributes) { if (string.Equals(existingAttribute.Name, name, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException( string.Format("Attribute with same name already exists: {0}", name), nameof(name)); } } ClearAttributeMaps(); var attribute = new AssociationAttribute(name, fieldType) { Association = this }; _attributes.Add(attribute); _msg.DebugFormat("Added attribute {0} to attributed association {1}", name, Name); return(attribute); }
public static IEnumerable <IObjectClass> GetIssueObjectClasses( [NotNull] IFeatureWorkspace issueRepositoryWorkspace) { Assert.ArgumentNotNull(issueRepositoryWorkspace, nameof(issueRepositoryWorkspace)); foreach (string objectClassName in IssueDatasetUtils.ObjectClassNames) { IObjectClass objectClass; try { objectClass = DatasetUtils.OpenObjectClass(issueRepositoryWorkspace, objectClassName); } catch (COMException e) { _msg.DebugFormat("Unable to open object class {0} from {1}: {2}", objectClassName, WorkspaceUtils.GetWorkspaceDisplayText( (IWorkspace)issueRepositoryWorkspace), e.Message); continue; } yield return(objectClass); } }
private static void TryMoveLegacyFolderContent() { if (!Directory.Exists(LegacyFolderPath)) { return; } if (!Directory.Exists(FolderPath)) { if (!TryCreateFormStateDirectory()) { return; } } string searchPattern = string.Format("*.{0}", _fileExtension); foreach (string legacyFilePath in Directory.GetFiles( LegacyFolderPath, searchPattern)) { string fileName = Assert.NotNull(Path.GetFileName(legacyFilePath)); string targetFilePath = Path.Combine(FolderPath, fileName); if (!File.Exists(targetFilePath)) { _msg.DebugFormat("Moving form state file {0} to {1}", legacyFilePath, FolderPath); try { File.Move(legacyFilePath, targetFilePath); } catch (Exception ex) { _msg.WarnFormat("Error moving form state file {0} to {1}: {2}", legacyFilePath, FolderPath, ex.Message); } } else { TryDeleteLegacyFile(legacyFilePath); } } TryDeleteLegacyFolderIfEmpty(); }
public static ShapeMsg ToShapeMsg( [CanBeNull] IGeometry geometry, ShapeMsg.FormatOneofCase format = ShapeMsg.FormatOneofCase.EsriShape, SpatialReferenceMsg.FormatOneofCase spatialRefFormat = SpatialReferenceMsg.FormatOneofCase.SpatialReferenceWkid) { if (geometry == null) { return(null); } Assert.ArgumentCondition(format == ShapeMsg.FormatOneofCase.EsriShape, "Unsupported format"); if (_msg.IsVerboseDebugEnabled) { _msg.DebugFormat("Converting geometry {0} to shape msg", GeometryUtils.ToString(geometry)); } var highLevelGeometry = GeometryUtils.GetHighLevelGeometry(geometry, true); var result = new ShapeMsg { EsriShape = ByteString.CopyFrom( GeometryUtils.ToEsriShapeBuffer(highLevelGeometry)) }; if (geometry.SpatialReference != null) { result.SpatialReference = ToSpatialReferenceMsg(geometry.SpatialReference, spatialRefFormat); } if (highLevelGeometry != geometry) { _msg.DebugFormat( "Geometry was converted to high-level geometry to encode."); Marshal.ReleaseComObject(highLevelGeometry); } return(result); }
public static Overlaps GetSelectableOverlaps( [NotNull] IEnumerable <IFeature> sourceFeatures, [NotNull] IList <IFeature> overlappingFeatures, [CanBeNull] ITrackCancel trackCancel = null) { var result = new Overlaps(); Stopwatch watch = Stopwatch.StartNew(); var sourceCount = 0; if (overlappingFeatures.Count == 0) { return(result); } SpatialHashSearcher <IFeature> targetIndex = SpatialHashSearcher <IFeature> .CreateSpatialSearcher( overlappingFeatures, GetEnvelope); foreach (IFeature sourceFeature in sourceFeatures) { if (trackCancel != null && !trackCancel.Continue()) { _msg.Debug("Overlaps calculation was cancelled."); return(result); } result.AddGeometries( new GdbObjectReference(sourceFeature), GetSelectableOverlaps(sourceFeature, targetIndex, result.Notifications, trackCancel).ToList()); _msg.DebugFormat( "Calculated overlaps for source feature {0}. Current overlaps count: {1}", GdbObjectUtils.ToString(sourceFeature), result.OverlapCount); sourceCount++; } _msg.DebugStopTiming(watch, "Calculated {0} overlaps between {1} source and {2} target features.", result.OverlapCount, sourceCount, overlappingFeatures.Count); return(result); }
private static bool IsConnected(CutSubcurve subcurve, SubcurveNode atNode, ICollection <SubcurveNode> checkedNodes, ICollection <CutSubcurve> intermediateCurves, Predicate <CutSubcurve> connectCondition) { // TODO: cache the thisSubcurve on the subcurve to improve performance if (_msg.IsVerboseDebugEnabled) { _msg.DebugFormat("Checking if connected at {0}/{1}", atNode.X, atNode.Y); } if (connectCondition != null && !connectCondition(subcurve)) { return(false); } if ((atNode == subcurve.FromNode && subcurve.TouchAtFromPoint) || (atNode == subcurve.ToNode && subcurve.TouchAtToPoint)) { checkedNodes.Add(atNode); intermediateCurves.Add(subcurve); return(true); } if (checkedNodes.Contains(atNode)) { return(false); } // block the node to avoid circles checkedNodes.Add(atNode); // NOTE: sometimes reshape candidates are not found because the node traversal cuts off the other // node's path (and vice versa when the second starts first): // TODO: always try the left-most / or for the other node the right-most subcurve (invert in second run) // to avoid cutting the other node's path -> this is not the perfect solution either (debug) // TODO: minimal but robust solution: make sure both ends are connected regardless of the other's path (only exclude other node) //IEnumerable<CutSubcurve> leaves = traverseRightCurvesFirst // ? atNode.ConnectedSubcurvesFromRightToLeft(subcurve) // : atNode.ConnectedSubcurvesFromLeftToRight(subcurve); foreach (CutSubcurve connectedSubcurve in atNode.ConnectedSubcurves) { if (connectedSubcurve != subcurve && IsConnected(connectedSubcurve, connectedSubcurve.OtherNode(atNode), checkedNodes, intermediateCurves, connectCondition)) { intermediateCurves.Add(subcurve); return(true); } } return(false); }
private static bool TryGetVersion([CanBeNull] out string version) { try { // the following code fails in the 64bit background environment (see COM-221) RuntimeInfo runtime = RuntimeManager.ActiveRuntime; if (runtime == null) { // not bound yet? // There seems to be another scenario where this is null (observed // for background gp on a particular setup, which also includes server). _msg.Debug( "RuntimeInfo not available. Trying to get version from assembly"); if (TryGetVersionFromVersionAssembly(out version)) { return(true); } _msg.DebugFormat("Unable to get ArcGIS version from assembly"); version = null; return(false); } version = runtime.Version; return(true); } catch (DllNotFoundException e) { _msg.VerboseDebugFormat( "Error accessing RuntimeManager: {0}; trying to get version from assembly", e.Message); if (TryGetVersionFromVersionAssembly(out version)) { return(true); } _msg.DebugFormat("Unable to get ArcGIS version from assembly"); return(false); } }
public static IEnumerable <X509Certificate2> FindValidCertificates( StoreName storeName, StoreLocation storeLocation, [NotNull] string searchString, [NotNull] IEnumerable <X509FindType> findTypes) { foreach (X509FindType findType in findTypes) { _msg.DebugFormat("Searching certificate store ({0}/{1}) trying {2} ({3})", storeName, storeLocation, findType, searchString); foreach (X509Certificate2 certificate in FindValidCertificates( storeName, storeLocation, searchString, findType)) { yield return(certificate); } } }
public void AddDatasets(Model model) { foreach (Dataset dataset in _datasets) { _msg.DebugFormat("Including dataset {0} in model", dataset.Name); model.AddDataset(dataset); } }
private void DerivedGeometriesCalculated([CanBeNull] CancelableProgressor progressor) { if (progressor == null || !progressor.CancellationToken.IsCancellationRequested) { _msg.DebugFormat("{0}: Derived geometries calculated.", Caption); } else { _msg.DebugFormat("{0}: Derived geometry calculation was cancelled.", Caption); } if (CanUseDerivedGeometries()) { StartSecondPhase(); } LogDerivedGeometriesCalculated(progressor); }
public static bool StoreTx( EditOperation.IEditContext editContext, [CanBeNull] IDictionary <Feature, Geometry> updates, [CanBeNull] IDictionary <Feature, IList <Geometry> > copies = null) { _msg.DebugFormat("Saving {0} updates and {1} inserts...", updates?.Count ?? 0, copies?.Count ?? 0); if (updates != null && updates.Count > 0) { foreach (KeyValuePair <Feature, Geometry> keyValuePair in updates) { StoreShape(keyValuePair, editContext); } _msg.InfoFormat("Successfully updated {0} feature(s).", updates.Count); } if (copies != null && copies.Count > 0) { foreach (KeyValuePair <Feature, IList <Geometry> > keyValuePair in copies) { Feature originalFeature = keyValuePair.Key; IList <Geometry> newGeometries = keyValuePair.Value; FeatureClass featureClass = originalFeature.GetTable(); foreach (Geometry newGeometry in newGeometries) { RowBuffer rowBuffer = DuplicateRow(originalFeature); SetShape(rowBuffer, newGeometry, featureClass); Feature newFeature = featureClass.CreateRow(rowBuffer); StoreShape(newFeature, newGeometry, editContext); } } _msg.InfoFormat("Successfully created {0} new feature(s).", copies.Count); } return(true); }
public void ExecuteVerification( [NotNull] string dataQualityXml, [NotNull] string specificationName, [NotNull] List <DataSource> dataSourceReplacements, [CanBeNull] AreaOfInterest areaOfInterest, [CanBeNull] string optionsXml, double tileSize, string outputDirectoryPath, IssueRepositoryType issueRepositoryType = IssueRepositoryType.FileGdb, bool ignoreConditionsForUnknownDatasets = true, ITrackCancel cancelTracker = null) { IList <XmlQualitySpecification> qualitySpecifications; XmlDataQualityDocument document = ReadXmlDocument(dataQualityXml, out qualitySpecifications); _msg.DebugFormat("Available specifications: {0}", StringUtils.Concatenate(qualitySpecifications.Select(s => s.Name), ", ")); XmlVerificationOptions verificationOptions = StringUtils.IsNotEmpty(optionsXml) ? VerificationOptionUtils.ReadOptionsXml(optionsXml) : null; IList <KeyValuePair <string, string> > properties = new List <KeyValuePair <string, string> >(); Directory.CreateDirectory(outputDirectoryPath); try { int errorCount; int warningCount; int exceptionCount; int unusedExceptionObjectCount; int rowCountWithStopConditions; bool fulfilled = Verify(document, specificationName, dataSourceReplacements, tileSize, outputDirectoryPath, issueRepositoryType, properties, verificationOptions, areaOfInterest, cancelTracker, ignoreConditionsForUnknownDatasets, out errorCount, out warningCount, out exceptionCount, out unusedExceptionObjectCount, out rowCountWithStopConditions); } catch (Exception) { StandaloneVerificationUtils.TryDeleteOutputDirectory(outputDirectoryPath); throw; } }
public static void ConfigureLogging(bool verboseRequired, [NotNull] string logConfigFileName) { int processId = Process.GetCurrentProcess().Id; LoggingConfigurator.SetGlobalProperty("LogFileSuffix", $"PID_{processId}"); LoggingConfigurator.Configure(logConfigFileName, GetLogConfigPaths(), useDefaultConfiguration: true); _msg.ReportMemoryConsumptionOnError = true; bool verboseLogging = verboseRequired || EnvironmentUtils.GetBooleanEnvironmentVariableValue(_verboseLoggingEnvVar); if (verboseLogging) { _msg.DebugFormat("Verbose logging configured by env var ({0})", _verboseLoggingEnvVar); _msg.IsVerboseDebugEnabled = true; } Assembly executingAssembly = Assembly.GetExecutingAssembly(); string bitness = Environment.Is64BitProcess ? "64 bit" : "32 bit"; _msg.InfoFormat("Logging configured for {0} ({1}) version {2}", executingAssembly.Location, bitness, executingAssembly.GetName().Version); if (_msg.IsVerboseDebugEnabled) { _msg.Debug("Environment variables:"); foreach (DictionaryEntry de in Environment.GetEnvironmentVariables()) { _msg.DebugFormat(" {0} = {1}", de.Key, de.Value); } } }
public static bool TryDeleteOutputDirectory([NotNull] string directoryPath) { try { _msg.DebugFormat("Trying to delete the generated output directory: {0}", directoryPath); const bool recursive = true; Directory.Delete(directoryPath, recursive); _msg.Debug("Directory successfully deleted"); return(true); } catch (Exception e) { _msg.WarnFormat("Error cleaning up generated output directory: {0}", e.Message); return(false); } }
private static ITestIssueCodes GetTestIssueCodesCore([NotNull] Type testType) { Type issueCodesType = typeof(ITestIssueCodes); IList <PropertyInfo> properties = GetCandidateProperties(testType, issueCodesType); if (properties.Count > 1) { // TODO combine into one? _msg.DebugFormat("Multiple test issue type properties found in type '{0}'", testType); } foreach (PropertyInfo propertyInfo in properties) { object value = GetStaticPropertyValue(propertyInfo); if (value != null) { return((ITestIssueCodes)value); } } // no property found; search fields IList <FieldInfo> fields = GetCandidateFields(testType, issueCodesType); if (fields.Count > 1) { // TODO combine into one? _msg.DebugFormat("Multiple test issue type fields found in type '{0}'", testType); } foreach (FieldInfo fieldInfo in fields) { object value = GetStaticFieldValue(fieldInfo); if (value != null) { return((ITestIssueCodes)value); } } return(null); }
private void ApplyLocation([NotNull] T formState) { if (!formState.HasLocation) { return; } const int minVisibleOffset = 80; var upperLeft = new Point(formState.Left, formState.Top); Rectangle workingArea = Screen.GetWorkingArea(upperLeft); int maxLeft = workingArea.Right - minVisibleOffset; int maxTop = workingArea.Height - minVisibleOffset; int minTop = workingArea.Top; int minLeft = workingArea.Left - minVisibleOffset; // try to restore location. Make sure that location is within current // screen dimensions int left = (formState.Left > maxLeft) ? maxLeft : ((formState.Left < minLeft) ? minLeft : formState.Left); int top = formState.Top > maxTop ? maxTop : (formState.Top < minTop ? minTop : formState.Top); // log if (_msg.IsVerboseDebugEnabled) { _msg.DebugFormat("Working area at {0}, {1}: {2}", formState.Left, formState.Top, workingArea); _msg.DebugFormat("Restore location: {0} {1}", left, top); } // apply Form.StartPosition = FormStartPosition.Manual; Form.Location = new Point(left, top); }
public void CanDetectSameDatabaseWithDifferentInstanceFormatAndDbNameAlias() { IWorkspace workspace1 = WorkspaceUtils.OpenSDEWorkspaceFromString( "INSTANCE=sde:oracle11g:/:SDE;USER=UNITTEST;PASSWORD=unittest@" + "PROSUITE_TEST_SERVER" + ";VERSION=SDE.DEFAULT;AUTHENTICATION_MODE=DBMS"); // different: shorter instance spec, different db name (alias for same db) IWorkspace workspace2 = WorkspaceUtils.OpenSDEWorkspaceFromString( "INSTANCE=sde:oracle11g;USER=UNITTEST;PASSWORD=unittest@PROSUITE_TEST_SERVER;VERSION=SDE.DEFAULT;AUTHENTICATION_MODE=DBMS"); _msg.DebugFormat("workspace1: {0}", WorkspaceUtils.GetConnectionString(workspace1)); _msg.DebugFormat("workspace2: {0}", WorkspaceUtils.GetConnectionString(workspace2)); Assert.IsTrue(WorkspaceUtils.IsSameDatabase(workspace1, workspace2)); }
public void SetValue(object target, object propertyValue) { if (InnerProperty.CanWrite) { InnerProperty.SetValue(target, propertyValue, null); } else { _msg.DebugFormat("Unable to write value to property {0}", InnerProperty.Name); } }
private static IEnumerable <IGeometry> GetReferenceGeometries( [NotNull] IObject obj, [NotNull] IList <IRelationshipClass> relationshipChainToFeatureClass) { if (relationshipChainToFeatureClass.Count == 0) { yield break; } if (relationshipChainToFeatureClass.Count == 1) { foreach (IObject relatedObject in GdbQueryUtils.GetRelatedObjects(obj, relationshipChainToFeatureClass)) { var relatedFeature = relatedObject as IFeature; if (relatedFeature != null) { yield return(relatedFeature.Shape); } else { _msg.DebugFormat("Related object in spatial relation is not a feature: {0}", GdbObjectUtils.ToString(relatedObject)); } } } else { int?shapeFieldIndex = null; foreach (IRow joinedRow in GetJoinedRows(obj, relationshipChainToFeatureClass)) { // determine shape field index based on the first row if (shapeFieldIndex == null) { int index; if (TryGetShapeFieldIndex(joinedRow.Fields, out index)) { shapeFieldIndex = index; } else { _msg.WarnFormat( "Shape field not found in joined table for getting reference geometry for {0}", DatasetUtils.GetName(obj.Class)); yield break; } } yield return(joinedRow.Value[shapeFieldIndex.Value] as IGeometry); } } }
protected virtual void StopEditing(bool saveEdits) { Assert.NotNull(_workspaceEdit); try { _workspaceEdit.StopEditing(saveEdits); } catch (COMException ex) { _msg.Debug("Exception in stop editing.", ex); if (ReconcileRedefinedVersion && ex.ErrorCode == (int)fdoError.FDO_E_VERSION_REDEFINED) { var version = _workspaceEdit as IVersion2; if (version != null) { if (!((IVersionEdit2)version).Reconcile(version.VersionName)) { _msg.DebugFormat( "Reconciled edit session successfully without conflicts. Saving again."); _workspaceEdit.StopEditing(saveEdits); return; } _msg.DebugFormat( "Reconciling the edit session with the edit version resulted in conflicts."); } else { // you never know: _msg.DebugFormat("Unexpected exception for non-versioned workspace"); } } throw; } }
private static bool TryGetVersion([CanBeNull] out string version) { try { // the following code fails // - in the 64bit background environment (see COM-221): DllNotFound // - in specific cross-thread situations: InvalidComObject RuntimeInfo runtime = RuntimeManager.ActiveRuntime; if (runtime == null) { // not bound yet? // There seems to be another scenario where this is null (observed // for background gp on a particular setup, which also includes server). _msg.Debug( "RuntimeInfo not available. Trying to get version from assembly"); if (TryGetVersionFromVersionAssembly(out version)) { return(true); } _msg.DebugFormat("Unable to get ArcGIS version from assembly"); version = null; return(false); } version = runtime.Version; return(true); } catch (DllNotFoundException e) { return(HandleErrorAndGetVersionFromAssembly(e, out version)); } catch (InvalidComObjectException e) { return(HandleErrorAndGetVersionFromAssembly(e, out version)); } }
public void Configure([NotNull] ITable table, [NotNull] ITableFields tableFields, [NotNull] IIssueTableFields fields) { Assert.ArgumentNotNull(table, nameof(table)); Assert.ArgumentNotNull(tableFields, nameof(tableFields)); Assert.ArgumentNotNull(fields, nameof(fields)); foreach (KeyValuePair <IssueAttribute, XmlFieldOptions> pair in _fieldOptionsByRole) { int fieldIndex = fields.GetIndex(pair.Key, table, optional: true); if (fieldIndex < 0) { _msg.DebugFormat( "No field with role {0} found in {1}; field configuration ignored", pair.Key, DatasetUtils.GetName(table)); continue; } var fieldInfo = (IFieldInfo3)tableFields.FieldInfo[fieldIndex]; Configure(fieldInfo, pair.Value); } foreach (KeyValuePair <string, XmlFieldOptions> pair in _fieldOptionsByName) { int fieldIndex = table.FindField(pair.Key); if (fieldIndex < 0) { _msg.DebugFormat("Field not found in {0}: {1}; field configuration ignored", DatasetUtils.GetName(table), pair.Key); continue; } var fieldInfo = (IFieldInfo3)tableFields.FieldInfo[fieldIndex]; Configure(fieldInfo, pair.Value); } }
/// <summary> /// Starts the grpc server at the specified address with the specified services. /// </summary> /// <param name="services">The list of service definitions to be hosted by the server.</param> /// <param name="hostName">The host name.</param> /// <param name="port">The port.</param> /// <param name="certificate">The certificate store's certificate (subject or thumbprint) /// or the PEM file containing the certificate chain.</param> /// <param name="privateKeyFilePath">The PEM file containing the private key (only if the /// certificate was provided by a PEM file.</param> /// <param name="enforceMutualTls">Enforce client authentication.</param> /// <returns></returns> public static Grpc.Core.Server StartGrpcServer( [NotNull] ICollection <ServerServiceDefinition> services, [NotNull] string hostName, int port, string certificate, string privateKeyFilePath, bool enforceMutualTls = false) { ServerCredentials serverCredentials = GrpcServerUtils.GetServerCredentials(certificate, privateKeyFilePath, enforceMutualTls); // Enough for large geometries var oneGb = (int)Math.Pow(1024, 3); IList <ChannelOption> channelOptions = GrpcServerUtils.CreateChannelOptions(oneGb); var server = new Grpc.Core.Server(channelOptions) { Ports = { new ServerPort(hostName, port, serverCredentials) } }; foreach (ServerServiceDefinition serviceDefinition in services) { server.Services.Add(serviceDefinition); } _msg.DebugFormat("Starting grpc server on {0} with the following services: {1}", ToHttpUrl(hostName, port, certificate != null), StringUtils.Concatenate(services, ", ")); server.Start(); return(server); }
public override bool OnLoad(object entity, object id, object[] state, string[] propertyNames, IType[] types) { if (LogLoadOutsideTransaction) { if (_session != null && _session.IsOpen && !_session.Transaction.IsActive) { string stack = GetStack(); if (!Equals(_lastStack, stack)) { _msg.DebugFormat( "IInterceptor.OnLoad() outside of transaction (type: {0}){1}{1}{2}", entity?.GetType().Name ?? "<entity is null>", Environment.NewLine, stack); _lastStack = stack; } } } return(base.OnLoad(entity, id, state, propertyNames, types)); }