当前位置: 首页>>代码示例>>C#>>正文


C# NeoDatis.GetUser方法代码示例

本文整理汇总了C#中NeoDatis.GetUser方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.GetUser方法的具体用法?C# NeoDatis.GetUser怎么用?C# NeoDatis.GetUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NeoDatis的用法示例。


在下文中一共展示了NeoDatis.GetUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetConnectionManager

		private NeoDatis.Odb.Core.Server.Layers.Layer3.Engine.Message ManageConnectCommand
			(NeoDatis.Odb.Core.Server.Message.ConnectMessage message)
		{
			// Gets the base identifier
			baseIdentifier = message.GetBaseIdentifier();
			// Gets the connection manager for this base identifier
			NeoDatis.Odb.Core.Server.Connection.ConnectionManager connectionManager = null;
			NeoDatis.Odb.Core.Server.Connection.IConnection connection = null;
			NeoDatis.Tool.Mutex.Mutex mutex = null;
			try
			{
				mutex = NeoDatis.Tool.Mutex.MutexFactory.Get(baseIdentifier).Acquire("connect");
				// Gets the connection manager for this base identifier
				connectionManager = GetConnectionManager(baseIdentifier, message.GetUser(), message
					.GetPassword(), false);
				if (connectionManager == null)
				{
					System.Text.StringBuilder buffer = new System.Text.StringBuilder();
					buffer.Append("Base ").Append(baseIdentifier).Append(" is not registered on this server!"
						);
					return new NeoDatis.Odb.Core.Server.Message.ConnectMessageResponse(baseIdentifier
						, "?", buffer.ToString());
				}
				string ip = message.GetIp();
				long dateTime = message.GetDateTime();
				connection = connectionManager.NewConnection(ip, dateTime, connectionManager.GetNbConnections
					());
				connection.SetCurrentAction(NeoDatis.Odb.Core.Server.Connection.ConnectionAction.
					ActionConnect);
				connectionId = connection.GetId();
				// Creates a new session for this connection
				NeoDatis.Odb.Core.Transaction.ISession session = new NeoDatis.Odb.Impl.Core.Server.Transaction.ServerSession
					(connection.GetStorageEngine(), connectionId);
				NeoDatis.Odb.Core.Layers.Layer3.IStorageEngine engine = connection.GetStorageEngine
					();
				// adds the session to the storage engine (it will be associated to
				// the current thread
				// The add session sets the correct meta model
				engine.AddSession(session, true);
				NeoDatis.Odb.TransactionId transactionId = engine.GetCurrentTransactionId();
				if (debug)
				{
					NeoDatis.Tool.DLogger.Info(new System.Text.StringBuilder("Connection from ").Append
						(ip).Append(" - cid=").Append(connection.GetId()).Append(" - session=").Append(session
						.GetId()).Append(" - Base Id=").Append(baseIdentifier).ToString());
				}
				// Returns the meta-model to the client
				NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = engine.GetSession(true
					).GetMetaModel();
				NeoDatis.Odb.Core.Server.Message.ConnectMessageResponse cmr = new NeoDatis.Odb.Core.Server.Message.ConnectMessageResponse
					(baseIdentifier, connection.GetId(), metaModel, transactionId);
				return cmr;
			}
			catch (System.Exception e)
			{
				string se = NeoDatis.Tool.Wrappers.OdbString.ExceptionToString(e, false);
				string msg = baseIdentifier + ":Error while connecting to  " + message.GetBaseIdentifier
					();
				NeoDatis.Tool.DLogger.Error(msg, e);
				return new NeoDatis.Odb.Core.Server.Message.ConnectMessageResponse(baseIdentifier
					, message.GetConnectionId(), msg + ":\n" + se);
			}
			finally
			{
				if (mutex != null)
				{
					mutex.Release("connect");
				}
				if (connection != null)
				{
					connection.EndCurrentAction();
				}
			}
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:74,代码来源:ClientServerConnection.cs


注:本文中的NeoDatis.GetUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。