Ejemplo n.º 1
0
        private static void CreateIdGenerators()
        {
            var mailIdGenerator     = new NHIdGenerator(typeof(MailMessage), "_TextId");
            var itemTextIdGenerator = new NHIdGenerator(typeof(ItemRecord), "m_ItemTextId");

            if (mailIdGenerator.LastId > itemTextIdGenerator.LastId)
            {
                TextIdGenerator = mailIdGenerator;
            }
            else
            {
                TextIdGenerator = itemTextIdGenerator;
            }
        }
Ejemplo n.º 2
0
        private static void CreateIdGenerators()
        {
            NHIdGenerator nhIdGenerator1 = new NHIdGenerator(typeof(MailMessage), "_TextId", 1L);
            NHIdGenerator nhIdGenerator2 = new NHIdGenerator(typeof(ItemRecord), "m_ItemTextId", 1L);

            if (nhIdGenerator1.LastId > nhIdGenerator2.LastId)
            {
                MailMgr.TextIdGenerator = nhIdGenerator1;
            }
            else
            {
                MailMgr.TextIdGenerator = nhIdGenerator2;
            }
        }
Ejemplo n.º 3
0
        public static bool Initialize()
        {
            DatabaseUtil.DBErrorHook = exception => AccountMgr.Instance.Count < 100;

            DatabaseUtil.DBType           = AuthServerConfiguration.DBType;
            DatabaseUtil.ConnectionString = AuthServerConfiguration.DBConnectionString;
            DatabaseUtil.DefaultCharset   = DefaultCharset;

            var asm = typeof(AuthDBMgr).Assembly;

            try
            {
                if (!DatabaseUtil.InitAR(asm))
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                OnDBError(e);

                // repeat init
                DatabaseUtil.InitAR(asm);
            }


            // create tables if not already existing
            var count = 0;

            try
            {
                count = Account.GetCount();
            }
            catch
            {
            }

            if (count == 0)
            {
                // in case that the CharacterRecord table does not exist -> Recreate schema
                DatabaseUtil.CreateSchema();
            }

            NHIdGenerator.InitializeCreators(OnDBError);

            return(true);
        }