コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IomConnection"/> class.
        /// </summary>
        /// <param name="iomConnection">The IOM connection instance which minimally implements
        /// <c>Aras.IOM.IServerConnection</c>.</param>
        /// <param name="itemFactory">The item factory.</param>
        /// <param name="CCO">The call context object.</param>
        public IomConnection(object iomConnection, IItemFactory itemFactory, object CCO)
        {
            _iomConnection = iomConnection;
            _cco           = CCO;
            var type   = iomConnection.GetType();
            var noArgs = new object[] { };

            Version       = type.Assembly.GetName().Version;
            _httpDatabase = (string)type.GetMethod("GetDatabaseName").Invoke(iomConnection, noArgs);
            _callAction   = (Action <string, XmlDocument, XmlDocument>)Delegate.CreateDelegate(typeof(Action <string, XmlDocument, XmlDocument>), iomConnection, type.GetMethod("CallAction"));

            var validateXml = (string)type.GetMethod("GetValidateUserXmlResult").Invoke(iomConnection, noArgs);
            var context     = new ServerContext(false);

            if (!string.IsNullOrEmpty(validateXml))
            {
                var data = XElement.Parse(validateXml).DescendantsAndSelf("Result").FirstOrDefault();
                foreach (var elem in data.Elements())
                {
                    switch (elem.Name.LocalName)
                    {
                    case "id":
                        UserId = elem.Value;
                        break;

                    case "i18nsessioncontext":
                        context.DefaultLanguageCode   = elem.Element("default_language_code").Value;
                        context.DefaultLanguageSuffix = elem.Element("default_language_suffix").Value;
                        context.LanguageCode          = elem.Element("language_code").Value;
                        context.LanguageSuffix        = elem.Element("language_suffix").Value;
                        context.Locale   = elem.Element("locale").Value;
                        context.TimeZone = elem.Element("time_zone").Value;
                        break;

                    case "ServerInfo":
                        foreach (var info in elem.Elements())
                        {
                            if (info.Name.LocalName == "Version")
                            {
                                Version = new Version(info.Value);
                            }
                        }
                        break;
                    }
                }
            }

            AmlContext = new ElementFactory(context, itemFactory);
            _vaultConn = new ArasVaultConnection(this);
        }
コード例 #2
0
 public TestConnection()
 {
     _vaultConn = new ArasVaultConnection(this);
     _vaultConn.InitializeStrategy();
 }