_Samples/Example_Account.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Data;
using System.Data.Common;

//<doc:using>
using ComLib;
using ComLib.Entities;
using ComLib.Account;
//</doc:using>
using ComLib.Application;


namespace ComLib.Samples
{
    /// <summary>
    /// Example for the Account namespace.
    /// </summary>
    public class Example_Account : App
    {       		
        /// <summary>
        /// Run the sample application.
        /// </summary>		
        public override BoolMessageItem Execute()
        {
            //<doc:example>		   
            // 1. Create.
            User account = new User("kishore", "password", "kishore@abc.com", true);
            User.Create(account);

            // 2. ChangePassword.
            User.ChangePassword("kishore", "password", "password2");

            // 3. Approve the user.
            User.Approve("kishore");

            // 4. Verify username and password.
            User.VerifyUser("kishore", "password2");

            // 5. Logon the user. Only updates the "LastLoginDate" in his account.
            User.LogOn("kishore", "password2", false);

            // 6. Lock out the user.
            User.LockOut("kishore", "spamming users");

            // 7. Undo the lockout.
            User.UndoLockOut("kishore", "false alarm");
			
			//</doc:example>
            return BoolMessageItem.True;
        }
		

        /// <summary>
        /// Configure the ActiveRecord for Accounts
        /// NOTES: - All service objects can be constructed with a repository, validator, settings object.            
        ///        - All service objects can be constructed with a fake repository ( in memory ) for testing.
后面还有 16 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。