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


C# Domain.Build方法代码示例

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


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

示例1: BuildRecreate

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static bool BuildRecreate()
        {
            try
            {
                LOGs.WriteLine( LogMessageType.MSG_SQL, "SQL: 开始建构SQL领域..." );
                s_Domain = new Domain( s_ConnectionUrl, "" );

                //LOGs.WriteLine( LogMessageType.MSG_INFO, "SQL: 连接 {0}", s_Domain.ConnectionUrl );
                LOGs.WriteLine( LogMessageType.MSG_SQL, "SQL: 信息 {0}", s_Domain.Driver.Info.Description );

                s_Domain.RegisterCulture( new Culture( "US", "U.S. English", new CultureInfo( "en-US", false ) ) );
                s_Domain.RegisterCulture( new Culture( "CN", "China. Chinese", new CultureInfo( "zh-CN", false ) ) );
                s_Domain.RegisterCulture( new Culture( "TW", "Taiwan. Chinese", new CultureInfo( "zh-TW", false ) ) );
                s_Domain.Cultures["CN"].Default = true;

                s_Domain.RegisterTypes( s_RegisterTypes );

                LOGs.WriteLine( LogMessageType.MSG_SQL, "SQL: 注册 (NameSpace){0}", s_RegisterTypes );

                s_Domain.Build( DomainUpdateMode.Recreate );
            }
            catch ( Exception exception )
            {
                LOGs.WriteLine( LogMessageType.MSG_FATALERROR, "SQL: 无法建构SQL领域 {0}", exception );
                return false;
            }

            using ( Session session = new Session( s_Domain ) )
            {
                session.BeginTransaction();

                Accounts accountsGM = (Accounts)session.CreateObject( typeof( Accounts ) );
                accountsGM.AccountsGuid = accountsGM.ID;
                accountsGM.AccountsName = "DemoSoft";
                accountsGM.Password = "faf2ca38c02c5f2ba1c49d200a03f9fb";
                accountsGM.GMLevel = 300; // GM
                accountsGM.Locked = false;
                accountsGM.Banned = true;
                accountsGM.CreateDate = DateTime.Now;

                Accounts accountsTest = (Accounts)session.CreateObject( typeof( Accounts ) );
                accountsTest.AccountsGuid = accountsTest.ID;
                accountsTest.AccountsName = "Test";
                accountsTest.Password = "faf2ca38c02c5f2ba1c49d200a03f9fb";
                accountsTest.GMLevel = 100; // Player
                accountsTest.Locked = false;
                accountsTest.Banned = false;
                accountsTest.CreateDate = DateTime.Now;

                Channels channelsCharacter1 = (Channels)session.CreateObject( typeof( Channels ) );
                channelsCharacter1.ServerGuid = channelsCharacter1.ID;
                channelsCharacter1.ServerName = "Angel";
                //channelsCharacter1.Host = "218.3.85.107";
                channelsCharacter1.Host = "127.0.0.1";
                channelsCharacter1.Port = 29100;
                channelsCharacter1.Status = 0;
                channelsCharacter1.OwnerGuid = Channels.CHARACTER_SERVER_ID;
                channelsCharacter1.Connected = 0;
                channelsCharacter1.MaxConnected = 0;

                Channels channelsCharacter2 = (Channels)session.CreateObject( typeof( Channels ) );
                channelsCharacter2.ServerGuid = channelsCharacter2.ID;
                channelsCharacter2.ServerName = "Hell";
                //channelsCharacter2.Host = "218.3.85.107";
                channelsCharacter2.Host = "127.0.0.1";
                channelsCharacter2.Port = 29100;
                channelsCharacter2.Status = 0;
                channelsCharacter2.OwnerGuid = Channels.CHARACTER_SERVER_ID;
                channelsCharacter2.Connected = 0;
                channelsCharacter2.MaxConnected = 0;

                Channels channelsWorld1 = (Channels)session.CreateObject( typeof( Channels ) );
                channelsWorld1.ServerGuid = channelsWorld1.ID;
                channelsWorld1.ServerName = "Angel-1";
                //channelsWorld1.Host = "218.3.85.107";
                channelsWorld1.Host = "127.0.0.1";
                channelsWorld1.Port = 29200;
                channelsWorld1.Status = 0;
                channelsWorld1.OwnerGuid = channelsCharacter1.ServerGuid;
                channelsWorld1.Connected = 0;
                channelsWorld1.MaxConnected = 300;

                Channels channelsWorld2 = (Channels)session.CreateObject( typeof( Channels ) );
                channelsWorld2.ServerGuid = channelsWorld2.ID;
                channelsWorld2.ServerName = "Angel-2";
                //channelsWorld2.Host = "218.3.85.107";
                channelsWorld2.Host = "127.0.0.1";
                channelsWorld2.Port = 29200;
                channelsWorld2.Status = 0;
                channelsWorld2.OwnerGuid = channelsCharacter1.ServerGuid;
                channelsWorld2.Connected = 0;
                channelsWorld2.MaxConnected = 300;

                Channels channelsWorld3 = (Channels)session.CreateObject( typeof( Channels ) );
                channelsWorld3.ServerGuid = channelsWorld3.ID;
                channelsWorld3.ServerName = "Hell-1";
//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:101,代码来源:BaseDatabase.cs

示例2: BuildDefault

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static bool BuildDefault()
        {
            try
            {
                LOGs.WriteLine( LogMessageType.MSG_SQL, "SQL: 开始建构SQL领域..." );
                s_Domain = new Domain( s_ConnectionUrl, "" );

                //LOGs.WriteLine( LogMessageType.MSG_INFO, "SQL: 连接 {0}", s_Domain.ConnectionUrl );
                LOGs.WriteLine( LogMessageType.MSG_SQL, "SQL: 信息 {0}", s_Domain.Driver.Info.Description );

                s_Domain.RegisterCulture( new Culture( "US", "U.S. English", new CultureInfo( "en-US", false ) ) );
                s_Domain.RegisterCulture( new Culture( "CN", "China. Chinese", new CultureInfo( "zh-CN", false ) ) );
                s_Domain.RegisterCulture( new Culture( "TW", "Taiwan. Chinese", new CultureInfo( "zh-TW", false ) ) );
                s_Domain.Cultures["CN"].Default = true;

                s_Domain.RegisterTypes( s_RegisterTypes );

                LOGs.WriteLine( LogMessageType.MSG_SQL, "SQL: 注册 (NameSpace){0}", s_RegisterTypes );

                s_Domain.Build( DomainUpdateMode.Block );
            }
            catch ( Exception exception )
            {
                LOGs.WriteLine( LogMessageType.MSG_FATALERROR, "SQL: 无法建构SQL领域 {0}", exception );
                return false;
            }

            LOGs.WriteLine( LogMessageType.MSG_SQL, "SQL: 完成建构SQL领域" );

            return true;
        }
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:35,代码来源:BaseDatabase.cs

示例3: BuildRecreate

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static bool BuildRecreate()
        {
            try
            {
                LOGs.WriteLine( LogMessageType.MSG_SQL, "SQL: 开始建构SQL领域..." );
                s_Domain = new Domain( s_ConnectionUrl, "" );

                //LOGs.WriteLine( LogMessageType.MSG_INFO, "SQL: 连接 {0}", s_Domain.ConnectionUrl );
                LOGs.WriteLine( LogMessageType.MSG_SQL, "SQL: 信息 {0}", s_Domain.Driver.Info.Description );

                s_Domain.RegisterCulture( new Culture( "US", "U.S. English", new CultureInfo( "en-US", false ) ) );
                s_Domain.RegisterCulture( new Culture( "CN", "China. Chinese", new CultureInfo( "zh-CN", false ) ) );
                s_Domain.RegisterCulture( new Culture( "TW", "Taiwan. Chinese", new CultureInfo( "zh-TW", false ) ) );
                s_Domain.Cultures["CN"].Default = true;

                s_Domain.RegisterTypes( s_RegisterTypes );

                LOGs.WriteLine( LogMessageType.MSG_SQL, "SQL: 注册 (NameSpace){0}", s_RegisterTypes );

                s_Domain.Build( DomainUpdateMode.Recreate );
            }
            catch ( Exception exception )
            {
                LOGs.WriteLine( LogMessageType.MSG_FATALERROR, "SQL: 无法建构SQL领域 {0}", exception );
                return false;
            }

            using ( Session session = new Session( s_Domain ) )
            {
                session.BeginTransaction();

                Accounts accountsGM = (Accounts)session.CreateObject( typeof( Accounts ) );
                accountsGM.AccountsGuid = accountsGM.ID;
                accountsGM.AccountsName = "DemoSoft";
                accountsGM.Password = "123456";
                accountsGM.GMLevel = 300; // GM
                accountsGM.Locked = false;
                accountsGM.Banned = true;
                accountsGM.CreateDate = DateTime.Now;

                Accounts accountsTest = (Accounts)session.CreateObject( typeof( Accounts ) );
                accountsTest.AccountsGuid = accountsTest.ID;
                accountsTest.AccountsName = "Test3009";
                accountsTest.Password = "e12345678";
                accountsTest.GMLevel = 100; // Player
                accountsTest.Locked = false;
                accountsTest.Banned = false;
                accountsTest.CreateDate = DateTime.Now;

                RealmList RealmList01 = (RealmList)session.CreateObject( typeof( RealmList ) );
                RealmList01.ServerGuid = RealmList01.ID;
                RealmList01.ServerName = "Angel";
                //channelsCharacter1.Host = "218.3.85.107";
                RealmList01.Host = "127.0.0.1";
                RealmList01.Port = 29100;
                RealmList01.Icon = 0;
                RealmList01.Color = 1;
                RealmList01.Timezone = 1;
                RealmList01.Population = 0;

                RealmList RealmList02 = (RealmList)session.CreateObject( typeof( RealmList ) );
                RealmList02.ServerGuid = RealmList02.ID;
                RealmList02.ServerName = "Hell";
                //channelsCharacter2.Host = "218.3.85.107";
                RealmList02.Host = "127.0.0.1";
                RealmList02.Port = 29100;
                RealmList02.Icon = 0;
                RealmList02.Color = 1;
                RealmList02.Timezone = 1;
                RealmList02.Population = 300;

                RealmList RealmList03 = (RealmList)session.CreateObject( typeof( RealmList ) );
                RealmList03.ServerGuid = RealmList03.ID;
                RealmList03.ServerName = "Angel-1";
                //channelsWorld1.Host = "218.3.85.107";
                RealmList03.Host = "127.0.0.1";
                RealmList03.Port = 29200;
                RealmList03.Icon = 0;
                RealmList03.Color = 1;
                RealmList03.Timezone = 1;
                RealmList03.Population = 300;

                RealmList RealmList04 = (RealmList)session.CreateObject( typeof( RealmList ) );
                RealmList04.ServerGuid = RealmList04.ID;
                RealmList04.ServerName = "Angel-2";
                //channelsWorld2.Host = "218.3.85.107";
                RealmList04.Host = "127.0.0.1";
                RealmList04.Port = 29200;
                RealmList04.Icon = 0;
                RealmList04.Color = 1;
                RealmList04.Timezone = 1;
                RealmList04.Population = 300;

                RealmList RealmList05 = (RealmList)session.CreateObject( typeof( RealmList ) );
                RealmList05.ServerGuid = RealmList05.ID;
                RealmList05.ServerName = "Hell-1";
//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:HappyQ-WowServer,代码行数:101,代码来源:BaseDatabase2.cs


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