小编Moh*_*are的帖子

如何在mvc 4的web.config文件中添加程序集

我有一个"MVC 4"项目,我想将一个程序集添加到web.config文件,但我不知道我应该把它放在哪里.我尝试任何方式,但我找不到解决方案.

每次我收到此错误:

您必须添加对程序集'System.Data.Entity,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的引用.

这是我的web.config文件:

    <?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->
<configuration>
  <connectionStrings>
    <add name="ParsGraphicEntities" connectionString="metadata=res://*/Entities.ParsGraphic.csdl|res://*/Entities.ParsGraphic.ssdl|res://*/Entities.ParsGraphic.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=ParsGraphic;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-UI.MVC.InternetApplication-2012317193118;Integrated Security=True" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="true" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <authentication …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc web-config asp.net-mvc-4

28
推荐指数
1
解决办法
6万
查看次数

如何像讲话泡泡一样设置WPF工具提示的样式?

我想塑造我的WPF工具提示,如下图所示:

在此输入图像描述

我该如何实现这一目标?

wpf xaml styles tooltip

19
推荐指数
1
解决办法
2万
查看次数

首先使用EF代码将datetime2数据类型转换为日期时间数据类型错误?

我首先在我的asp.net mvc应用程序中使用EF代码.这是我的代码:

Request.RequestDate = DateTime.Now;
Run Code Online (Sandbox Code Playgroud)

RequestDate的类型是我的数据库中的datetime.这是我使用上面代码时发生的错误!:

将datetime2数据类型转换为日期时间数据类型会导致超出范围的值.

请帮我.谢谢.

c# entity-framework sql-server-2008 ef-code-first entity-framework-4.3

13
推荐指数
2
解决办法
4万
查看次数

EF Code First级联删除和更新?

我的实体是:

public class Customer
{
    public Customer()
    {
        Invoices = new List<Invoice>();
        Payments = new List<Payment>();
    }

    public int ID { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }

    public IList<Payment> Payments { get; set; }
}

public class Payment
{
    public int ID { get; set; }
    public int CustomerID { get; set; }
    public decimal CreditPrice { get; set; }
    public decimal DebitPrice { get; set; }
    public DateTime …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework ef-code-first entity-framework-4.3

9
推荐指数
1
解决办法
1万
查看次数

如何使用StructureMap配置ASP.NET标识ApplicationUserManager

我在我的项目中使用asp.net标识并使用structuremap作为DI框架.问题是当我使用构造函数注入时,ApplicationUserManager没有配置它的所有成员,例如TokenProvider,...

这是我的ApplicationUserManager类:

public class ApplicationUserManager : UserManager<User, long>
{
    public ApplicationUserManager(IUserStore<User, long> store)
        : base(store)
    {
    }

    public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
    {
        var manager = new ApplicationUserManager(new CustomUserStore(context.Get<InsuranceManagementContext>()));

        // Configure the application user manager
        manager.UserValidator = new UserValidator<User, long>(manager)
        {
            AllowOnlyAlphanumericUserNames = false,
            RequireUniqueEmail = false
        };

        manager.PasswordValidator = new PasswordValidator
        {
            RequireDigit = true,
            RequiredLength = 8,
            RequireLowercase = false,
            RequireNonLetterOrDigit = true,
            RequireUppercase = false
        };

        var dataProtectionProvider = options.DataProtectionProvider;
        if (dataProtectionProvider != null)
        { …
Run Code Online (Sandbox Code Playgroud)

structuremap asp.net-mvc dependency-injection asp.net-identity asp.net-identity-2

9
推荐指数
1
解决办法
2万
查看次数

如何在wpf数据绑定中正确显示数字?

我正在使用wpf,我的问题是显示浮点数.一般来说,当我将我的数据(浮点数)绑定到datagrid列时,它甚至在我的舍入数字(3.00)后显示两个零,但我想显示这两个零,只是我的值没有舍入.如何解决这个问题呢?

3 - > 3不是3.00

3.62 - > 3.62

data-binding format floating-point wpf xaml

3
推荐指数
1
解决办法
2975
查看次数

如何用kotlin包裹List <Int>

我想通过Bundle将数据类(包含int列表作为属性)传递给其他活动,因此我需要将Parcelable实现添加到我的数据类中.关于如何包裹这个房产的任何想法?

data class Test(val id: Long, val files: List<Int>?) : Parcelable {

constructor(parcel: Parcel) : this(
        parcel.readLong(),
        TODO("files"))

override fun writeToParcel(parcel: Parcel, flags: Int) {
    parcel.writeLong(id)
}

override fun describeContents(): Int {
    return 0
}

companion object CREATOR : Parcelable.Creator<Test> {
    override fun createFromParcel(parcel: Parcel): Test {
        return Test(parcel)
    }

    override fun newArray(size: Int): Array<Test?> {
        return arrayOfNulls(size)
    }
}
Run Code Online (Sandbox Code Playgroud)

java android parcel parcelable kotlin

3
推荐指数
2
解决办法
2781
查看次数

如何使用for循环而不是foreach循环?

如何用for循环实现这个foreach循环?因为我听说for循环比foreach循环要快得多.

   foreach (RV item in gridview.SelectedItems.ToList())
   {
        R req= db.Requests.Single(x => x.Id == item.Id);
        ...
   }
Run Code Online (Sandbox Code Playgroud)

c# optimization foreach loops for-loop

2
推荐指数
1
解决办法
1921
查看次数