GVKun编程网logo

asp.net-mvc-4 – EF5.x中对PadLeft缺乏支持的任何解决方法?

14

如果您对asp.net-mvc-4–EF5.x中对PadLeft缺乏支持的任何解决方法?感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解asp.net-mvc-4–EF5.x中对PadLeft缺

如果您对asp.net-mvc-4 – EF5.x中对PadLeft缺乏支持的任何解决方法?感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解asp.net-mvc-4 – EF5.x中对PadLeft缺乏支持的任何解决方法?的各种细节,此外还有关于ASP.NET MVC 4 EF5与MySQL、ASP.NET MVC 中对 Model 进行分步验证的解决方法、asp.net – 在.NET中以编程方式添加HttpHandler的任何方法?、asp.net-mvc – ASP MVC – 有默认内容类型的任何常量?的实用技巧。

本文目录一览:

asp.net-mvc-4 – EF5.x中对PadLeft缺乏支持的任何解决方法?

asp.net-mvc-4 – EF5.x中对PadLeft缺乏支持的任何解决方法?

我正在研究MVC4和Entity Framework 5中的应用程序,最近在执行查询时遇到了这个异常.

{“LINQ to Entities does not recognize the method ‘System.String PadLeft(Int32,Char)’ method,and this method cannot be translated into a store expression.”}

当我在过去遇到过类似的错误时,我只是在查询之外创建了一个变量,然后在LINQ语句中使用了该变量.不幸的是,在这种情况下,我正在操纵行结果,所以我不确定如何去做或如果这是最好的方法.任何帮助,将不胜感激.我的查询如下:

IQueryable<System.String> LEAPrograms = db.datamart_Draft
            .Where(where => where.snapshot_id == snapshot_id
                && !String.IsNullOrEmpty(where.entity_program))
            .Select(sel => (sel.entity_program.PadLeft(PROGRAMLENGTH,'0'))).distinct();

解决方法

这不是太优雅,但它做的工作:

...
.Select(sel => sqlFunctions.Replicate
                   ("0",PROGRAMLENGTH - sel.entity_program.Length)
             + sel.entity_program)

ASP.NET MVC 4 EF5与MySQL

ASP.NET MVC 4 EF5与MySQL

所以我刚刚拿起了VS2012,我想要启动一个带有EF5的ASP.NET MVC 4应用程序。

我的主机没有MSsql,所以我必须使用MysqL。

如何告诉我的应用程序应该使用MysqL? (我想要使用devart MysqL连接器或MysqL.com)

解决方法

您需要使用连接字符串DbProviderFactory和MysqL Connector 6.5.4的自定义DatabaseInitializer设置您的配置。我详细说明了 full step for getting EF5 and MySql to play,including code for the initializers on my blog.如果您需要ASP.Net会员提供程序解决方案,那么我将在 ASP.NET Membership/Role providers for MySQL?发布解决方案,同时提供完整的EF5 MysqL解决方案。

MysqL连接器当前不支持EF 5迁移,ASP.NET仅支持MS sql不是MysqL的SimpleMembership(MVC4默认值)。以下解决方案适用于Code First。

步骤是:

从NuGet抓住EF 5
>从NuGet(6.5.4)或MysqL(6.6.4)中抓取MysqL.Data和MysqL.Data.Entity
>配置MysqL数据提供程序
>配置MysqL连接字符串
>创建自定义MysqL数据库初始化程序
>配置自定义MysqL数据库初始化程序
>如果需要,请配置ASP.NET成员资格

DbProvider

<system.data>
 <DbProviderFactories>
  <remove invariant="MysqL.Data.MysqLClient"/>
  <add name="MysqL Data Provider" invariant="MysqL.Data.MysqLClient"
    description=".Net Framework Data Provider for MysqL" 
    type="MysqL.Data.MysqLClient.MysqLClientFactory,MysqL.Data" />
 </DbProviderFactories>
</system.data>

连接字符串

<connectionStrings>
  <add name="ConnectionStringName" 
    connectionString="Datasource=hostname;Database=schema_name;uid=username;pwd=Pa$$w0rd;" 
    providerName="MysqL.Data.MysqLClient" />
</connectionStrings>

数据库初始化程序

如果您使用NuGet(6.5.4)中的MysqL连接器,则需要自定义初始化程序。代码可在http://brice-lambson.blogspot.se/2012/05/using-entity-framework-code-first-with.html
或http://www.nsilverbullet.net/2012/11/07/6-steps-to-get-entity-framework-5-working-with-mysql-5-5/

然后将其添加到配置中

<configSections>
  <section name="entityFramework" 
    type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,EntityFramework,Version=5.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" />
</configSections>
<entityFramework>
  <contexts>
      <context type="Namespace.YourContextName,AssemblyName">
         <databaseInitializer 
           type="Namespace.YourChosenInitializer,AssemblyName">
         </databaseInitializer>
      </context>
    </contexts>
    <defaultConnectionFactory 
      type="MysqL.Data.MysqLClient.MysqLClientFactory,MysqL.Data" />
</entityFramework>

ASP.NET成员资格

<membership defaultProvider="MysqLMembershipProvider">
  <providers>
    <clear />
    <add name="MysqLMembershipProvider"
         type="MysqL.Web.Security.MysqLMembershipProvider,MysqL.Web,Version=6.5.4.0,PublicKeyToken=c5687fc88969c44d"
     autogenerateschema="true"
     connectionStringName="*NAME_OF_YOUR_CONN_STRING*"
     enablePasswordRetrieval="false"
     enablePasswordReset="true"
     requiresQuestionAndAnswer="false"
     requiresUniqueEmail="false"
     passwordFormat="Hashed"
     maxInvalidPasswordAttempts="5"
     minrequiredPasswordLength="6"
     minrequiredNonalphanumericCharacters="0"
     passwordAttemptwindow="10"
     passwordStrengthRegularExpression=""
     applicationName="/" />
  </providers>
</membership>

获取AccountController和Views工作:

>删除MVC 4 AccountController,AccountModels,帐户视图文件夹和_LoginPartial共享视图>创建一个新的MVC 3 Web应用程序>将MVC 3 AccountController,AccountModels,帐户视图文件夹和_logonPartial共享视图复制到您的MVC 4应用程序中>在@ Html.Partial(“_ logonPartial”)的共享_Layout视图中替换@ Html.Partial(“_ LoginPartial”)

ASP.NET MVC 中对 Model 进行分步验证的解决方法

ASP.NET MVC 中对 Model 进行分步验证的解决方法

    在我之前的文章:ASP.NET MVC2.0 结合 WF4.0 实现用户多步注册流程中将一个用户的注册分成了四步,而这四个步骤都是在完善一个 Model 的信息,但是又分页面填写信息的,当时我加上 ModelState.IsValid 这句验证代码的时候,根本没法通过验证,因为在注册的前面三步,注册用户的 Model 信息都没填写完整,而 ModelState.IsValid 是对一个实体的所有属性进行判断验证的。当时很纠结,因为刚接触 Asp.net MVC,故没有找到解决方案。这篇文章将给出解决的办法。看下面需要验证的 Model 的代码如下:

代码
public class UserViewModel
{
[DisplayName(
" step " )]
[Required(ErrorMessage
= " You must select a step . " )]
public int Step { get ; set ; }
// 个人信息
[Required(ErrorMessage = " 姓名不能为空 " )]
[StringLength(
20 , ErrorMessage = " 姓名长度不能超过 20 个字符 " )]
public string Name { get ; set ; }

[RegularExssion(
@" 120|((1[0-1]|\d)?\d) " , ErrorMessage = " 年龄格式不对 " )]
public int ? Age { get ; set ; }

// 职位信息
[Required(ErrorMessage = " 职位不能为空 " )]
public string Post { get ; set ; }
public int ? Salary { get ; set ; }

// 学历信息
[Required(ErrorMessage = " 毕业院校不能为空 " )]
public string University { get ; set ; }
public int ? GraduationYear { get ; set ; }

// 联系信息
[Required(ErrorMessage = " 邮件不能为空 " )]
[RegularExssion(
@" ^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z| " + @" 0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z] " + @" [a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$ " , ErrorMessage = " 邮件格式不正确 " )]
public string Email { get ; set ; }
public int ? Mobile { get ; set ; }

public IEnumerable < SelectListItem > StepList { get ; set ; }

public UserViewModel()
{
var list
= new List < SelectListItem > () {
new SelectListItem { Text = " (Select) " },
new SelectListItem { Value = " 1 " , Text = " Step1 " },
new SelectListItem { Value = " 2 " , Text = " Step2 " },
new SelectListItem { Value = " 3 " , Text = " Step3 " },
new SelectListItem { Value = " 4 " , Text = " Step4 " }
};
this .StepList = new SelectList(list, " Value " , " Text " );
}


}

实现:

    这篇文章这种情况服务端和客户端的验证都会讲到。为了简化起见,这里我除去的 WF 的流程功能,直接用下拉框表示,当下拉框选择 step1 表示填写第一步注册的信息,当下拉框选择 step2 表示填写第二步注册的信息,当下拉框选择 step3 表示填写第三步注册的信息,当下拉框选择 step4 表示填写第四步注册的信息。写得很啰嗦,但是这个很容易实现,我使用 Jquery 来显示和隐藏下拉框对应的 Step。Jquery 代码如下:

代码
< script type = " text/javascript " >
$(
function () {
$.fn.enable
= function () {
return this .show().removeAttr( " disabled " );
}

$.fn.disable
= function () {
return this .hide().attr( " disabled " , " disabled " );
}
var dllStep = $( " #Step " );
var step1 = $( " #Step1,#Step1 input " );
var step2 = $( " #Step2,#Step2 input " );
var step3 = $( " #Step3,#Step3 input " );
var step4 = $( " #Step4,#Step4 input " );
setControls();

dllStep.change(
function () {
setControls();
});

function setControls() {
switch (dllStep.val()) {
case " 1 " :
step1.enable();
step2.disable();
step3.disable();
step4.disable();
break ;
case " 2 " :
step1.disable();
step2.enable();
step3.disable();
step4.disable();
break ;
case " 3 " :
step1.disable();
step2.disable();
step3.enable();
step4.disable();
break ;
case " 4 " :
step1.disable();
step2.disable();
step3.disable();
step4.enable();
break ;
case "" :
step1.disable();
step2.disable();
step3.disable();
step4.disable();
break ;
}
}
});
< / script>

如下图:

第一步:填写姓名和年龄。

 第二步:填写职位和薪水

 第三步填写:毕业院校和毕业时间

第四步填写:邮箱和电话

    为了实现这样的验证,我们可以将验证的错误信息中移除不在当前步骤填写的字段的错误信息,写一个类 InputValidationModelBinder 继承 DefaultModelBinder 并重载 OnModelUpdated 方法,将不必要的错误信息清除,代码如下:

public class InputValidationModelBinder : DefaultModelBinder
{
protected override void OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
var modelState
= controllerContext.Controller.ViewData.ModelState;
var valueProvider
= controllerContext.Controller.ValueProvider;

var keysWithNoIncomingValue
= modelState.Keys.Where(x => ! valueProvider.ContainsPrefix(x));
foreach (var key in keysWithNoIncomingValue)
modelState[key].Errors.Clear();
}
}

     上面是服务端的代码,对于客户端,我们都知道 asp.net MVC 客户端验证时通过 MicrosoftMvcValidation.js 去实现的。看下面代码。

1 validate: function Sys_Mvc_FormContext$validate(eventName) {
2 var fields = this .fields;
3 var errors = [];
4 for ( var i = ; i < fields.length; i ++ ) {
5 var field = fields[i];
6 if ( ! field.elements[ ].disabled) {
7 var thisErrors = field.validate(eventName);
8 if (thisErrors) {
9 Array.addRange(errors, thisErrors);
10 }
11 }
12 }
13 if ( this .replaceValidationSummary) {
14 this .clearErrors();
15 this .addErrors(errors);
16 }
17 return errors;
18 }
19 }

在第 6 行代码加入了一句判断:当页面的元素没有被 disabled 的时候才去验证。

好了这样就实现了一次只对 Model 中的几个属性字段进行验证。

运行:

asp.net mvc 的验证机制只对 model 中当前页面的属性进行验证:

填写正确通过验证:

总结:本文解决了我之前遗留下来的一个问题。实现了在 ASP.NET MVC 中对 Model 进行多步验证。希望对你有所帮助,如果你有更好的方法,欢迎给我留言。 


原文链接: http://www.cnblogs.com/zhuqil/archive/2010/09/27/Mvc-Validation.html

asp.net – 在.NET中以编程方式添加HttpHandler的任何方法?

asp.net – 在.NET中以编程方式添加HttpHandler的任何方法?

我一直在研究这一点,但没有遇到一个答案 – 有什么办法编程地添加一个HttpHandler到ASP.NET网站,而不添加到web.config?

解决方法

通过添加一个HttpHandler,我假设你的意思是配置文件
<system.web>
    <httpHandlers>...</httpHandler>
</system.web>

通过在请求期间直接添加IHttpHandler,可以自动控制它。所以在PostMapRequestHandler in the Application Lifecycle,你会做以下,在你自己的自定义IHttpModule:

private void context_PostMapRequestHandler(object sender,EventArgs e)
{
    HttpContext context = ((HttpApplication)sender).Context;
    IHttpHandler myHandler = new MyHandler();
    context.Handler = myHandler;
}

这将自动设置该请求的处理程序。显然,你可能想要包含一些逻辑来检查诸如动词,请求url等等,但这是如何做的。此外,这是多少流行的URL Rewriters工作,如:

http://urlrewriter.codeplex.com

不幸的是,使用pre built configuration handler that the web.config是隐藏的,似乎不可访问。它基于称为IHttpHandlerFactory的接口。

更新IHttpHandlerFactory可以像任何其他IHttpHandler一样使用,只能用作启动点而不是处理点。看到这篇文章。

http://www.uberasp.net/getarticle.aspx?id=49

asp.net-mvc – ASP MVC – 有默认内容类型的任何常量?

asp.net-mvc – ASP MVC – 有默认内容类型的任何常量?

在框架中是否有所有 standard content types的一组常量?

解决方法

把它作为一个响亮的没有,我写了我自己的。这是星期日。
///<summary>Used to denote the encoding necessary for files containing JavaScript source code. The alternative MIME type for this file type is text/javascript.</summary>
    public const string ApplicationXJavascript = "application/x-javascript";

    ///<summary>24bitLinear PCMaudio at 8-48kHz,1-N channels; Defined inRFC 3190</summary>
    public const string AudioL24 = "audio/L24";

    ///<summary>Adobe Flashfiles for example with the extension .swf</summary>
    public const string ApplicationXShockwaveFlash = "application/x-shockwave-flash";

    ///<summary>Arbitrary binary data.[5]Generally speaking this type identifies files that are not associated with a specific application. Contrary to past assumptions by software packages such asApachethis is not a type that should be applied to unkNown files. In such a case,a server or application should not indicate a content type,as it may be incorrect,but rather,should omit the type in order to allow the recipient to guess the type.[6]</summary>
    public const string ApplicationOctetStream = "application/octet-stream";

    ///<summary>Atom Feeds</summary>
    public const string ApplicationAtomXml = "application/atom+xml";

    ///<summary>Cascading Style Sheets; Defined inRFC 2318</summary>
    public const string TextCss = "text/css";

    ///<summary>commands; subtype resident inGeckobrowsers likeFirefox3.5</summary>
    public const string TextCmd = "text/cmd";

    ///<summary>Comma-separated values; Defined inRFC 4180</summary>
    public const string TextCsv = "text/csv";

    ///<summary>deb (file format),a software package format used by the Debian project</summary>
    public const string ApplicationXDeb = "application/x-deb";

    ///<summary>Defined inRFC 1847</summary>
    public const string MultipartEncrypted = "multipart/encrypted";

    ///<summary>Defined inRFC 1847</summary>
    public const string MultipartSigned = "multipart/signed";

    ///<summary>Defined inRFC 2616</summary>
    public const string MessageHttp = "message/http";

    ///<summary>Defined inRFC 4735</summary>
    public const string ModelExample = "model/example";

    ///<summary>device-independent document in DVI format</summary>
    public const string ApplicationXDvi = "application/x-dvi";

    ///<summary>DTDfiles; Defined byRFC 3023</summary>
    public const string ApplicationXmlDtd = "application/xml-dtd";

    ///<summary>ECMAScript/JavaScript; Defined inRFC 4329(equivalent toapplication/ecmascriptbut with looser processing rules) It is not accepted inIE 8or earlier -text/javascriptis accepted but it is defined as obsolete inRFC 4329. The "type" attribute of the<script>tag inHTML5is optional and in practice omitting the media type of JavaScript programs is the most interoperable solution since all browsers have always assumed the correct default even before HTML5.</summary>
    public const string ApplicationJavascript = "application/javascript";

    ///<summary>ECMAScript/JavaScript; Defined inRFC 4329(equivalent toapplication/javascriptbut with stricter processing rules)</summary>
    public const string ApplicationEcmascript = "application/ecmascript";

    ///<summary>EDIEDIFACTdata; Defined inRFC 1767</summary>
    public const string ApplicationEdifact = "application/EDIFACT";

    ///<summary>EDIX12data; Defined inRFC 1767</summary>
    public const string ApplicationEdiX12 = "application/EDI-X12";

    ///<summary>Email; Defined inRFC 2045andRFC 2046</summary>
    public const string MessagePartial = "message/partial";

    ///<summary>Email;EMLfiles,MIME files,MHTfiles,MHTMLfiles; Defined inRFC 2045andRFC 2046</summary>
    public const string MessageRfc822 = "message/rfc822";

    ///<summary>Extensible MarkuP Language; Defined inRFC 3023</summary>
    public const string textxml = "text/xml";

    ///<summary>Extensible MarkuP Language; Defined in RFC 3023</summary>
    public const string ApplicationXml = "application/xml";

    ///<summary>Flash video(FLV files)</summary>
    public const string VideoXFlv = "video/x-flv";

    ///<summary>GIFimage; Defined inRFC 2045andRFC 2046</summary>
    public const string ImageGif = "image/gif";

    ///<summary>GoogleWebToolkit data</summary>
    public const string textxGwtRpc = "text/x-gwt-rpc";

    ///<summary>Gzip</summary>
    public const string ApplicationXGzip = "application/x-gzip";

    ///<summary>HTML; Defined inRFC 2854</summary>
    public const string TextHtml = "text/html";

    ///<summary>ICOimage; Registered[9]</summary>
    public const string ImageVndMicrosoftIcon = "image/vnd.microsoft.icon";

    ///<summary>IGS files,IGESfiles; Defined inRFC 2077</summary>
    public const string ModelIges = "model/iges";

    ///<summary>IMDNInstant Message disposition Notification; Defined inRFC 5438</summary>
    public const string MessageImdnXml = "message/imdn+xml";

    ///<summary>JavaScript Object NotationjsON; Defined inRFC 4627</summary>
    public const string Applicationjson = "application/json";

    ///<summary>JavaScript Object Notation (JSON) Patch; Defined inRFC 6902</summary>
    public const string ApplicationjsonPatch = "application/json-patch+json";

    ///<summary>JavaScript - Defined in and obsoleted byRFC 4329in order to discourage its usage in favor ofapplication/javascript. However,text/javascriptis allowed in HTML 4 and 5 and,unlikeapplication/javascript,has cross-browser support. The "type" attribute of the<script>tag inHTML5is optional and there is no need to use it at all since all browsers have always assumed the correct default (even in HTML 4 where it was required by the specification).</summary>
    [Obsolete]
    public const string TextJavascript = "text/javascript";

    ///<summary>JPEGJFIF image; Associated with Internet Explorer; Listed inms775147(v=vs.85)- Progressive JPEG,initiated before global browser support for progressive JPEGs (Microsoft and Firefox).</summary>
    public const string ImagePjpeg = "image/pjpeg";

    ///<summary>JPEGJFIF image; Defined inRFC 2045andRFC 2046</summary>
    public const string ImageJpeg = "image/jpeg";

    ///<summary>jQuerytemplate data</summary>
    public const string textxJqueryTmpl = "text/x-jquery-tmpl";

    ///<summary>KMLfiles (e.g. forGoogle Earth)</summary>
    public const string ApplicationVndGoogleEarthKmlXml = "application/vnd.google-earth.kml+xml";

    ///<summary>LaTeXfiles</summary>
    public const string ApplicationXLatex = "application/x-latex";

    ///<summary>Matroskaopen media format</summary>
    public const string VideoXMatroska = "video/x-matroska";

    ///<summary>Microsoft Excel2007 files</summary>
    public const string ApplicationVndOpenxmlformatsOfficedocumentSpreadsheetmlSheet = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";

    ///<summary>Microsoft Excelfiles</summary>
    public const string ApplicationVndMsExcel = "application/vnd.ms-excel";

    ///<summary>Microsoft Powerpoint2007 files</summary>
    public const string ApplicationVndOpenxmlformatsOfficedocumentPresentationmlPresentation = "application/vnd.openxmlformats-officedocument.presentationml.presentation";

    ///<summary>Microsoft Powerpointfiles</summary>
    public const string ApplicationVndMsPowerpoint = "application/vnd.ms-powerpoint";

    ///<summary>Microsoft Word2007 files</summary>
    public const string ApplicationVndOpenxmlformatsOfficedocumentWordprocessingmlDocument = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";

    ///<summary>Microsoft Wordfiles[15]</summary>
    public const string ApplicationMsword = "application/msword";

    ///<summary>MIMEEmail; Defined inRFC 2045andRFC 2046</summary>
    public const string MultipartAlternative = "multipart/alternative";

    ///<summary>MIMEEmail; Defined inRFC 2045andRFC 2046</summary>
    public const string MultipartMixed = "multipart/mixed";

    ///<summary>MIMEEmail; Defined inRFC 2387and used byMHTML(HTML mail)</summary>
    public const string MultipartRelated = "multipart/related";

    ///<summary>MIMEWebform; Defined inRFC 2388</summary>
    public const string MultipartFormData = "multipart/form-data";

    ///<summary>MozillaXULfiles</summary>
    public const string ApplicationVndMozillaXulXml = "application/vnd.mozilla.xul+xml";

    ///<summary>MP3or otherMPEGaudio; Defined inRFC 3003</summary>
    public const string AudioMpeg = "audio/mpeg";

    ///<summary>MP4audio</summary>
    public const string AudioMp4 = "audio/mp4";

    ///<summary>MP4video; Defined inRFC 4337</summary>
    public const string VideoMp4 = "video/mp4";

    ///<summary>MPEG-1video with multiplexed audio; Defined inRFC 2045andRFC 2046</summary>
    public const string VideoMpeg = "video/mpeg";

    ///<summary>MSH files,MESH files; Defined inRFC 2077,SILO files</summary>
    public const string ModelMesh = "model/mesh";

    ///<summary>mulawaudio at 8kHz,1 channel; Defined inRFC 2046</summary>
    public const string AudioBasic = "audio/basic";

    ///<summary>OggTheoraor other video (with audio); Defined inRFC 5334</summary>
    public const string VideoOgg = "video/ogg";

    ///<summary>OggVorbis,Speex,Flacand other audio; Defined inRFC 5334</summary>
    public const string AudioOgg = "audio/ogg";

    ///<summary>Ogg,a multimedia bitstreamcontainer format; Defined inRFC 5334</summary>
    public const string ApplicationOgg = "application/ogg";

    ///<summary>OP</summary>
    public const string ApplicationXopXml = "application/xop+xml";

    ///<summary>opendocumentGraphics; Registered[14]</summary>
    public const string ApplicationVndoasisopendocumentGraphics = "application/vnd.oasis.opendocument.graphics";

    ///<summary>opendocumentPresentation; Registered[13]</summary>
    public const string ApplicationVndoasisopendocumentPresentation = "application/vnd.oasis.opendocument.presentation";

    ///<summary>opendocumentSpreadsheet; Registered[12]</summary>
    public const string ApplicationVndoasisopendocumentSpreadsheet = "application/vnd.oasis.opendocument.spreadsheet";

    ///<summary>opendocumentText; Registered[11]</summary>
    public const string ApplicationVndoasisopendocumentText = "application/vnd.oasis.opendocument.text";

    ///<summary>p12 files</summary>
    public const string ApplicationXPkcs12 = "application/x-pkcs12";

    ///<summary>p7b and spc files</summary>
    public const string ApplicationXPkcs7Certificates = "application/x-pkcs7-certificates";

    ///<summary>p7c files</summary>
    public const string ApplicationXPkcs7Mime = "application/x-pkcs7-mime";

    ///<summary>p7r files</summary>
    public const string ApplicationXPkcs7certreqresp = "application/x-pkcs7-certreqresp";

    ///<summary>p7s files</summary>
    public const string ApplicationXPkcs7Signature = "application/x-pkcs7-signature";

    ///<summary>Portable Document Format,PDFhas been in use for document exchange on the Internet since 1993; Defined inRFC 3778</summary>
    public const string ApplicationPdf = "application/pdf";

    ///<summary>Portable Network Graphics; Registered,[8]Defined inRFC 2083</summary>
    public const string ImagePng = "image/png";

    ///<summary>PostScript; Defined inRFC 2046</summary>
    public const string ApplicationPostscript = "application/postscript";

    ///<summary>QuickTimevideo; Registered[10]</summary>
    public const string VideoQuicktime = "video/quicktime";

    ///<summary>Rararchive files</summary>
    public const string ApplicationXRarCompressed = "application/x-rar-compressed";

    ///<summary>RealAudio; Documented inRealPlayer Customer Support Answer 2559</summary>
    public const string AudioVndRnRealaudio = "audio/vnd.rn-realaudio";

    ///<summary>Resource Description Framework; Defined byRFC 3870</summary>
    public const string ApplicationRdfXml = "application/rdf+xml";

    ///<summary>RSS Feeds</summary>
    public const string ApplicationRSSXml = "application/RSS+xml";

    ///<summary>SOAP; Defined byRFC 3902</summary>
    public const string ApplicationSoapXml = "application/soap+xml";

    ///<summary>StuffItarchive files</summary>
    public const string ApplicationXStuffit = "application/x-stuffit";

    ///<summary>SVGvector image; Defined inSVG Tiny 1.2 Specification Appendix M</summary>
    public const string ImageSvgXml = "image/svg+xml";

    ///<summary>Tag Image File Format(only for Baseline TIFF); Defined inRFC 3302</summary>
    public const string ImageTiff = "image/tiff";

    ///<summary>Tarballfiles</summary>
    public const string ApplicationXTar = "application/x-tar";

    ///<summary>Textual data; Defined inRFC 2046andRFC 3676</summary>
    public const string TextPlain = "text/plain";

    ///<summary>TrueType FontNo registered MIME type,but this is the most commonly used</summary>
    public const string ApplicationXFontTtf = "application/x-font-ttf";

    ///<summary>vCard(contact information); Defined inRFC 6350</summary>
    public const string TextVcard = "text/vcard";

    ///<summary>Vorbisencoded audio; Defined inRFC 5215</summary>
    public const string AudioVorbis = "audio/vorbis";

    ///<summary>WAVaudio; Defined inRFC 2361</summary>
    public const string AudioVndWave = "audio/vnd.wave";

    ///<summary>Web Open Font Format; (candidate recommendation; useapplication/x-font-woffuntil standard is official)</summary>
    public const string ApplicationFontWoff = "application/font-woff";

    ///<summary>WebMMatroska-based open media format</summary>
    public const string VideoWebm = "video/webm";

    ///<summary>WebMopen media format</summary>
    public const string AudioWebm = "audio/webm";

    ///<summary>Windows Media AudioRedirector; Documented inMicrosoft help page</summary>
    public const string AudioxmsWax = "audio/x-ms-wax";

    ///<summary>Windows Media Audio; Documented inMicrosoft KB 288102</summary>
    public const string AudioxmsWma = "audio/x-ms-wma";

    ///<summary>Windows Media Video; Documented inMicrosoft KB 288102</summary>
    public const string VideoxmsWmv = "video/x-ms-wmv";

    ///<summary>WRLfiles,Vrmlfiles; Defined inRFC 2077</summary>
    public const string ModelVrml = "model/vrml";

    ///<summary>X3disOstandard for representing3D computer graphics,X3DXMLfiles</summary>
    public const string ModelX3DXml = "model/x3d+xml";

    ///<summary>X3disOstandard for representing3D computer graphics,X3DBbinaryfiles</summary>
    public const string ModelX3DBinary = "model/x3d+binary";

    ///<summary>X3disOstandard for representing3D computer graphics,X3DVVrmlfiles</summary>
    public const string ModelX3DVrml = "model/x3d+vrml";

    ///<summary>XHTML; Defined byRFC 3236</summary>
    public const string ApplicationXhtmlXml = "application/xhtml+xml";

    ///<summary>ZIParchive files; Registered[7]</summary>
    public const string ApplicationZip = "application/zip";

今天关于asp.net-mvc-4 – EF5.x中对PadLeft缺乏支持的任何解决方法?的分享就到这里,希望大家有所收获,若想了解更多关于ASP.NET MVC 4 EF5与MySQL、ASP.NET MVC 中对 Model 进行分步验证的解决方法、asp.net – 在.NET中以编程方式添加HttpHandler的任何方法?、asp.net-mvc – ASP MVC – 有默认内容类型的任何常量?等相关知识,可以在本站进行查询。

本文标签:

上一篇asp.net-mvc – Can Meteor可以运行Microsoft后端(即EF和ASP.net MVC)(microsoft asp.net mvc2)

下一篇asp.net-mvc – 实体框架种子与身份(Microsoft.Owin.Security)用户