很多人一说到
actionscript 3.0宝典就会觉得内容实在是太多了,学习起来有很大的难度。但是事实上其实我们在学习actionscript 3.0宝典的时候,要想掌握其中的知识信息,掌握重点,关键是在于自己对actionscript 3.0宝典的学习技巧的掌握。比如说:
public class HomeController :Controller
{
public ActionResult Index()
{
var model = new DemoModel {Email ="test@test.com"};
return View(model);
}
}
public class DemoModel
{
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
}
创建对应的强类型视图
@modelTestMvc.Controllers.DemoModel
<fieldset>
<legend>DemoModel</legend>
<div >
@Html.DisplayFor(model =>model.Email)
</div>
</fieldset>
public class ModelMetadata
{
private readonly Type _modelType; //Model的类型
private readonly string_propertyName; //属性名称
private object _model; //Model的值
private Func<object>_modelAccessor; //为了用Lambd给Model传值(这是潮流)
privateIEnumerable<ModelMetadata> _properties; //Model属性值的ModelMetadata集合
//通过子类的ComputeXX系列函数将Model的注解特性赋值到下面几个属性
public virtual string DataTypeName {get; set; }
public virtual string Description {get; set; }
public virtual stringDisplayFormatString { get; set; }
public virtual string DisplayName {get; set; }
(其它略,属性太多了,影响阅读...)
public object Model
{
get
{
if (_modelAccessor != null)
{
_model = _modelAccessor();
_modelAccessor = null;
}
return _model;
}
}
public virtualIEnumerable<ModelMetadata> Properties
{
get
{
if (_properties == null)
{
IEnumerable<ModelMetadata> originalProperties =Provider.GetMetadataForProperties(Model, RealModelType);
_propertiesInternal =SortProperties(originalProperties.AsArray());
_properties = newReadOnlyCollection<ModelMetadata>(_propertiesInternal);
}
return _properties;
}
}
protected ModelMetadataProviderProvider { get; set; } //ModelMetadata的创建者(后面会有介绍)
public virtual string TemplateHint {get; set; } //Model显示用的模板名称
public classCachedDataAnnotationsModelMetadata :CachedModelMetadata<CachedDataAnnotationsMetadataAttributes>
{
publicCachedDataAnnotationsModelMetadata(CachedDataAnnotationsModelMetadataProviderprovider, Type containerType, Type modelType, string propertyName,IEnumerable<Attribute> attributes)
: base(provider, containerType,modelType, propertyName, newCachedDataAnnotationsMetadataAttributes(attributes.ToArray()))
{
PrototypeCache = newCachedDataAnnotationMetadataAttributes(attributes.ToArray()); //这个赋值应该在它的父类CachedModelMetadata
以上是关于actionscript 3.0宝典的重点内容,我们在学习actionscript 3.0宝典的时候只要是能够懂得掌握上述的知识信息,那么我们在学习actionscript 3.0宝典的时候基本就能够掌握其中的核心内容了。关于actionscript3.0的操作也就掌握的八九不离十了。
public class HomeController :Controller
{
public ActionResult Index()
{
var model = new DemoModel {Email ="test@test.com"};
return View(model);
}
}
public class DemoModel
{
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
}
创建对应的强类型视图
@modelTestMvc.Controllers.DemoModel
<fieldset>
<legend>DemoModel</legend>
<div >
@Html.DisplayFor(model =>model.Email)
</div>
</fieldset>
public class ModelMetadata
{
private readonly Type _modelType; //Model的类型
private readonly string_propertyName; //属性名称
private object _model; //Model的值
private Func<object>_modelAccessor; //为了用Lambd给Model传值(这是潮流)
privateIEnumerable<ModelMetadata> _properties; //Model属性值的ModelMetadata集合
//通过子类的ComputeXX系列函数将Model的注解特性赋值到下面几个属性
public virtual string DataTypeName {get; set; }
public virtual string Description {get; set; }
public virtual stringDisplayFormatString { get; set; }
public virtual string DisplayName {get; set; }
(其它略,属性太多了,影响阅读...)
public object Model
{
get
{
if (_modelAccessor != null)
{
_model = _modelAccessor();
_modelAccessor = null;
}
return _model;
}
}
public virtualIEnumerable<ModelMetadata> Properties
{
get
{
if (_properties == null)
{
IEnumerable<ModelMetadata> originalProperties =Provider.GetMetadataForProperties(Model, RealModelType);
_propertiesInternal =SortProperties(originalProperties.AsArray());
_properties = newReadOnlyCollection<ModelMetadata>(_propertiesInternal);
}
return _properties;
}
}
protected ModelMetadataProviderProvider { get; set; } //ModelMetadata的创建者(后面会有介绍)
public virtual string TemplateHint {get; set; } //Model显示用的模板名称
public classCachedDataAnnotationsModelMetadata :CachedModelMetadata<CachedDataAnnotationsMetadataAttributes>
{
publicCachedDataAnnotationsModelMetadata(CachedDataAnnotationsModelMetadataProviderprovider, Type containerType, Type modelType, string propertyName,IEnumerable<Attribute> attributes)
: base(provider, containerType,modelType, propertyName, newCachedDataAnnotationsMetadataAttributes(attributes.ToArray()))
{
PrototypeCache = newCachedDataAnnotationMetadataAttributes(attributes.ToArray()); //这个赋值应该在它的父类CachedModelMetadata
以上是关于actionscript 3.0宝典的重点内容,我们在学习actionscript 3.0宝典的时候只要是能够懂得掌握上述的知识信息,那么我们在学习actionscript 3.0宝典的时候基本就能够掌握其中的核心内容了。关于actionscript3.0的操作也就掌握的八九不离十了。