本文整理汇总了C#中MyModel类的典型用法代码示例。如果您正苦于以下问题:C# MyModel类的具体用法?C# MyModel怎么用?C# MyModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyModel类属于命名空间,在下文中一共展示了MyModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init(MyModel model, Matrix matrix, float rescaleModel = 1.0f)
{
Model = model;
model.Rescale(rescaleModel);
InstanceData.LocalMatrix = matrix;
model.LoadData();
}
示例2: TryUpdateModel_ReturnsFalse_IfBinderReturnsFalse
public async Task TryUpdateModel_ReturnsFalse_IfBinderReturnsFalse()
{
// Arrange
var metadataProvider = new Mock<IModelMetadataProvider>();
metadataProvider.Setup(m => m.GetMetadataForType(null, It.IsAny<Type>()))
.Returns(new ModelMetadata(metadataProvider.Object, null, null, typeof(MyModel), null))
.Verifiable();
var binder = new Mock<IModelBinder>();
binder.Setup(b => b.BindModelAsync(It.IsAny<ModelBindingContext>()))
.Returns(Task.FromResult(false));
var model = new MyModel();
// Act
var result = await ModelBindingHelper.TryUpdateModelAsync(
model,
null,
Mock.Of<HttpContext>(),
new ModelStateDictionary(),
metadataProvider.Object,
GetCompositeBinder(binder.Object),
Mock.Of<IValueProvider>(),
Enumerable.Empty<IModelValidatorProvider>());
// Assert
Assert.False(result);
Assert.Null(model.MyProperty);
metadataProvider.Verify();
}
示例3: Login
public ActionResult Login(LoginRegister l)
{
if (ModelState.IsValid)
{
using (MyModel db = new MyModel())
{
var v = db.Users.Where(a => a.Email.Equals(l.login.Email) && a.Password.Equals(l.login.Password)).FirstOrDefault();
if (v != null)
{
Session["LogedUserID"] = v.UserID.ToString();
Session["LoggedUserFullname"] = v.FirstName.ToString();
return RedirectToRoute("SurveyPage");
}
else
{
ModelState.AddModelError("Email", "Email or password is not correct");
return View(l);
}
}
}
return View(new LoginRegister { login = new Login(), users = new Users() });
}
示例4: Start
public void Start(MyModel model, MyLine line, IntersectionFlags flags = IntersectionFlags.DIRECT_TRIANGLES)
{
result = null;
m_model = model;
m_line = line;
m_flags = flags;
}
示例5: ShouldRoundtripTypeWithEvent
public void ShouldRoundtripTypeWithEvent()
{
var model = RuntimeTypeModel.Create();
model.AutoCompile = false;
model.DynamicTypeFormatting += new TypeFormatEventHandler(model_DynamicTypeFormatting);
var orig = new MyModel { Type = typeof(SqlCommand) };
var clone = (MyModel)model.DeepClone(orig);
Assert.AreSame(typeof(SqlCommand), clone.Type);
string s = "abc";
byte[] expected = new byte[Encoding.UTF8.GetByteCount(s) + 2];
Encoding.UTF8.GetBytes(s, 0, s.Length, expected, 2);
expected[0] = 0x0A; // field-header
expected[1] = 0x03; // length
Program.CheckBytes(orig, model, expected);
model.CompileInPlace();
clone = (MyModel)model.DeepClone(orig);
Assert.AreSame(typeof(SqlCommand), clone.Type);
Program.CheckBytes(orig, model, expected);
var compiled = model.Compile();
compiled.DynamicTypeFormatting += new TypeFormatEventHandler(model_DynamicTypeFormatting);
clone = (MyModel)compiled.DeepClone(orig);
Assert.AreSame(typeof(SqlCommand), clone.Type);
Program.CheckBytes(orig, compiled, expected);
}
示例6: TryUpdateModel_ReturnsFalse_IfBinderReturnsNull
public async Task TryUpdateModel_ReturnsFalse_IfBinderReturnsNull()
{
// Arrange
var metadataProvider = new EmptyModelMetadataProvider();
var binder = new Mock<IModelBinder>();
binder.Setup(b => b.BindModelAsync(It.IsAny<ModelBindingContext>()))
.Returns(Task.FromResult<ModelBindingResult>(null));
var model = new MyModel();
// Act
var result = await ModelBindingHelper.TryUpdateModelAsync(
model,
null,
Mock.Of<HttpContext>(),
new ModelStateDictionary(),
metadataProvider,
GetCompositeBinder(binder.Object),
Mock.Of<IValueProvider>(),
new List<IInputFormatter>(),
new DefaultObjectValidator(new IExcludeTypeValidationFilter[0], metadataProvider),
Mock.Of<IModelValidatorProvider>());
// Assert
Assert.False(result);
Assert.Null(model.MyProperty);
}
示例7: TryUpdateModel_ReturnsFalse_IfModelValidationFails
public async Task TryUpdateModel_ReturnsFalse_IfModelValidationFails()
{
// Arrange
var binders = new IModelBinder[]
{
new TypeConverterModelBinder(),
new ComplexModelDtoModelBinder(),
new MutableObjectModelBinder()
};
var validator = new DataAnnotationsModelValidatorProvider();
var model = new MyModel();
var modelStateDictionary = new ModelStateDictionary();
var values = new Dictionary<string, object>
{
{ "", null }
};
var valueProvider = new DictionaryBasedValueProvider(values);
// Act
var result = await ModelBindingHelper.TryUpdateModelAsync(
model,
"",
Mock.Of<HttpContext>(),
modelStateDictionary,
new DataAnnotationsModelMetadataProvider(),
GetCompositeBinder(binders),
valueProvider,
new[] { validator });
// Assert
Assert.False(result);
Assert.Equal("The MyProperty field is required.",
modelStateDictionary["MyProperty"].Errors[0].ErrorMessage);
}
示例8: MainViewModel
public MainViewModel()
{
Competition = new CompetitionVM();
MyModel myModel = new MyModel();
Competition comp = myModel.Competitions.First();
//Competition = new CompetitionVM(comp);
}
示例9: SetModelLOD0
protected void SetModelLOD0(MyModel model)
{
m_ModelLOD0 = model;
Flags |= MyElementFlag.EF_AABB_DIRTY;
//if (GetRigidBody() != null)
// MyPhysics.physicsSystem.GetRigidBodyModule().AddActiveRigid(GetRigidBody());
}
示例10: TestCase
public void TestCase ()
{
var model = new MyModel (){ AnInt = 1, AString = "A", ABool = true };
var aFileName = BinaryFormatterExample.Serialize (model);
var outModel = BinaryFormatterExample.Deserialize<MyModel> (aFileName);
Assert.AreEqual (model, outModel);
}
示例11: TestSetup
public void TestSetup()
{
backingEntity = new MockModelATableEntity();
model = new MockModelA(backingEntity);
propertyManager = model.Property;
// --
myBackingEntity = new MyTableEntity();
myModel = new MyModel(myBackingEntity);
}
示例12: LoadModelInDrawInBackground
internal static void LoadModelInDrawInBackground(MyModel model)
{
if (MyFakes.LOAD_MODELS_IMMEDIATELY)
{
model.LoadInDraw(Managers.LoadingMode.Immediate);
}
else
{
m_loadingQueue.Enqueue(model);
m_loadModelEvent.Set();
}
}
示例13: ParticleRenderObject
public ParticleRenderObject(MyModel __model, bool __ShadowCaster,
bool __ShadowReceiver,
bool __Transparent,
bool __SelfIlmn)
{
_model = __model;
isshadowcaster = __ShadowCaster;
isshadowreceiver = __ShadowReceiver;
isTransparent = __Transparent;
isSelfIllumination = __SelfIlmn;
}
示例14: GetIntersectionWithLine
// Difference between GetIntersectionWithLine and GetIntersectionWithLineRecursive is that the later doesn't calculate
// final result, but is better suited for recursive nature of octree. Don't call GetIntersectionWithLineRecursive() from
// the outisde of this class, it's private method.
public MyIntersectionResultLineTriangleEx? GetIntersectionWithLine(MyEntity physObject, MyModel model, ref MyLine line, float? minDistanceUntilNow, IntersectionFlags flags)
{
MyIntersectionResultLineTriangle? foundTriangle = GetIntersectionWithLineRecursive(model, ref line, minDistanceUntilNow);
if (foundTriangle != null)
{
return new MyIntersectionResultLineTriangleEx(foundTriangle.Value, physObject, ref line);
}
else
{
return null;
}
}
示例15: Test
public Test()
{
var sw = new Stopwatch();
sw.Start();
XamlReader.Load(this);
sw.Stop();
Log.Write(this, "loaded in {0} seconds", sw.Elapsed.TotalSeconds);
MyCheckBox.Checked = true;
MyTextArea.Text = "This form was created via xaml!";
DataContext = new MyModel { SomeText = "Text from data model" };
}