示例#1
0
 public Role(string name, Role parentRole)
 {
     this.Name = name;
     if (parentRole != null)
     {
         this.ParentRoleId = parentRole.Id;
     }
 }
        public override void CreateRole(string roleName)
        {
            using (var session = this.DocumentStore.OpenSession())
            {
                try
                {
                    var role = new Role(roleName, null);
                    role.ApplicationName = this.ApplicationName;

                    session.Store(role);
                    session.SaveChanges();
                }
                catch (Exception ex)
                {
                    // TODO: log exception properly
                    Console.WriteLine(ex.ToString());
                    throw;
                }
            }
        }