小编Bhu*_*ake的帖子

谁能解释什么是 private readonly IStudentRepository _studentRepository?为什么被采取?

有两个文件:一个给出界面如下:

IStudentInterface.cs

 public interface IStudentService
{
    IEnumerable<Student> GetStudents();
    Student GetStudentById(int id);
    void CreateStudent(Student student);
    void UpdateStudent(Student student);
    void DeleteStudent(int id);
    void SaveStudent();
}
Run Code Online (Sandbox Code Playgroud)

学生服务.cs:

 public class StudentService : IStudentService
  {
    private readonly IStudentRepository _studentRepository;
    private readonly IUnitOfWork _unitOfWork;
    public StudentService(IStudentRepository studentRepository, IUnitOfWork unitOfWork)
    {
        this._studentRepository = studentRepository;
        this._unitOfWork = unitOfWork;
    }  
    #region IStudentService Members

    public IEnumerable<Student> GetStudents()
    {
        var students = _studentRepository.GetAll();
        return students;
    }

    public Student GetStudentById(int id)
    {
        var student = _studentRepository.GetById(id);
        return student;
    }

    public void CreateStudent(Student …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection inversion-of-control asp.net-mvc-4

0
推荐指数
1
解决办法
1528
查看次数

在无序列表中插入图像而不是项目符号

我有以下代码:

     <div class="extra-details">
                               <ul class="browse-product-usp">

                               <li>
                                <span class="text">
                                    Dimension: 11x11 inch
                                </span>
                              </li>

                            <li>
                                <span class="text">
                                    Paper Depth: 285 gsm
                                </span>
                            </li>

                    </ul>
            </div>
Run Code Online (Sandbox Code Playgroud)

这在浏览器中看如下:

在此输入图像描述

我的CSS如下:

    .text {
              color:#333;
              font-family: Helvetica, Arial, sans-serif;

  }
Run Code Online (Sandbox Code Playgroud)

当我把下面的代码:

    ul{list-style-image:url(../img/arrow.png);}
Run Code Online (Sandbox Code Playgroud)

它扭曲了我的文字从iimage线.请帮忙 在此输入图像描述

我希望箭头和文字在同一行.

css

0
推荐指数
1
解决办法
1719
查看次数

添加新用户以使用ASP.NET Membership类

我使用vs2012 express版构建webform应用程序.
配置SqlMembership提供程序以将用户凭据存储到我的Sqlserver数据库后,我想创建用户用户但我收到此错误:无法声明类型为'System.Web.Security.Membership的变量.
我花了两个小时谷歌搜索仍然没有决议.这是我的代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security.Membership;
//using Microsoft.AspNet.Membership.OpenAuth;

namespace Practice_project.Account
{
public partial class Register : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //RegisterUser.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"];
    }

   public void RegisterUser_CreatedUser(object sender, EventArgs e)
    {


        Membership Create_New_User = Membership.CreateUser(UserName, Password);

    }
}
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net

0
推荐指数
1
解决办法
1185
查看次数

获取当前用户Asp.净C#

有没有办法让当前用户进入aspx页面,页面中有html定义?(我知道如何在aspx.cs页面中获取它)

c# asp.net

-1
推荐指数
1
解决办法
9260
查看次数