BondInEtwLinqpadDriver.BondDynamicDriver.GetContextConstructorArguments C# (CSharp) Method

GetContextConstructorArguments() public method

Returns argument values to pass to into the data context's constructor, based on a given connection info.
public GetContextConstructorArguments ( IConnectionInfo cxInfo ) : object[]
cxInfo IConnectionInfo Connection information, as entered by the user.
return object[]
        public override object[] GetContextConstructorArguments(IConnectionInfo cxInfo)
        {
            var playback = new Playback();

            var bondInEtwProperties = new BondInEtwProperties(cxInfo);

            try
            {
                var bondTypemap = new EnvelopeTypeMap();

                var typeMaps = TypeFinder
                    .LoadTypeMaps(TypeCache.ResolveCacheDirectory(bondInEtwProperties.ContextName))
                    .Where(i => i != typeof(EnvelopeTypeMap))
                    .Select(Activator.CreateInstance)
                    .OfType<ITypeMap<IEnvelope>>()
                    .Concat(new[] { bondTypemap })
                    .ToArray();

                foreach (var file in bondInEtwProperties.Files)
                {
                    var file1 = file;

                    ((IPlaybackConfiguration)playback).AddInput(
                        () => BinaryEtwObservable.FromFiles(file1),
                        typeMaps);
                }

                Thread.SetData(LocalDataStoreSlot, playback);
                return new object[] { playback };
            }
            catch (Exception error)
            {
                MessageBox.Show(error.Message, "Error compiling generated code.");
            }

            return new object[0];
        }