示例#1
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            SimpleUser user = ObjectSpace.FindObject <SimpleUser>(new BinaryOperator("UserName", "Barkol"));

            if (user == null)
            {
                user          = ObjectSpace.CreateObject <SimpleUser>();
                user.UserName = "******";
                user.FullName = "Barkol2011";
            }
            // Make the user an administrator
            user.IsAdministrator = true;
            // Set a password if the standard authentication type is used
            user.SetPassword("");
            // Save the user to the database
            user.Save();
        }
示例#2
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            SimpleUser sam = ObjectSpace.FindObject <SimpleUser>(new BinaryOperator("UserName", "Sam"));

            if (sam == null)
            {
                sam                 = ObjectSpace.CreateObject <SimpleUser>();
                sam.UserName        = "******";
                sam.IsAdministrator = true;
                sam.Save();
            }
            SimpleUser john = ObjectSpace.FindObject <SimpleUser>(new BinaryOperator("UserName", "John"));

            if (john == null)
            {
                john                 = ObjectSpace.CreateObject <SimpleUser>();
                john.UserName        = "******";
                john.IsAdministrator = true;
                john.Save();
            }
        }