What is the Microsoft ASP.NET Web Pages 2 Data Nuget Package for?

前端 未结 1 661
深忆病人
深忆病人 2021-02-05 09:50

I understand that the minimum Nuget packages that I need for an ASP.NET MVC 4 Project are:

  • Microsoft ASP.NET MVC 4
  • Microsoft ASP.NET Razor 2
  • Micr
相关标签:
1条回答
  • 2021-02-05 10:07

    After doing some experimenting with MVC 4 Projects with and without the following packages

    • Microsoft ASP.NET Web Pages 2 Data
    • Microsoft ASP.NET Web Pages 2 Web Data

    I have come to the conclusion that the Nuget Package description of

    This package contains the runtime assemblies for ASP.NET Web Pages. ASP.NET Web Pages and the new Razor syntax provide a fast, terse, clean and lightweight way to combine server code with HTML to create dynamic web content.

    is very misleading.

    The Microsoft ASP.NET Web Pages 2 Data actually just contains the WebMatrix.Data.dll. This the only assembly that is added to your project when adding this package. Looking at the MSDN reference for this assembly

    The WebMatrix.Data namespace contains classes that simplify database interaction in ASP.NET Web Pages. This namespace includes classes that help you to open, query, and send commands to a database, and to work with database rows that are returned by SQL queries.

    And for the Microsoft ASP.NET Web Pages 2 Web Data, this package only adds the WebMatrix.DataWeb.dll (dependent on WebMatrix.Data.dll). The MSDN reference for this assembly is

    The WebMatrix.WebData namespace contains classes that simplify membership and security in ASP.NET Web Pages. This namespace includes classes that help you create and delete user accounts, define roles, and manage account passwords.

    So if not using WebMatrix Data to access databases and not using the simple membership provider, these packages are unnecessary.

    If you are using the Simple Membership provider, or extending the Extended Membership Provider, then these packages are necessary.

    0 讨论(0)
提交回复
热议问题