当前位置: 首页>>代码示例>>C#>>正文


C# MyModel类代码示例

本文整理汇总了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();
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:7,代码来源:MyCubePart.cs

示例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();
        }
开发者ID:Nakro,项目名称:Mvc,代码行数:29,代码来源:ModelBindingHelperTest.cs

示例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() });
            }
开发者ID:Azcanban,项目名称:Hospital-Website-.net,代码行数:28,代码来源:UserController.cs

示例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;
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:7,代码来源:MyQuantizedBvhResult.cs

示例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);
            
        }
开发者ID:XewTurquish,项目名称:vsminecraft,代码行数:29,代码来源:Type.cs

示例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);
        }
开发者ID:njannink,项目名称:sonarlint-vs,代码行数:27,代码来源:ModelBindingHelperTest.cs

示例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);
        }
开发者ID:Nakro,项目名称:Mvc,代码行数:35,代码来源:ModelBindingHelperTest.cs

示例8: MainViewModel

        public MainViewModel()
        {
            Competition = new CompetitionVM();

            MyModel myModel = new MyModel();
            Competition comp = myModel.Competitions.First();
               //Competition = new CompetitionVM(comp);
        }
开发者ID:Linksonder,项目名称:Prog5,代码行数:8,代码来源:MainViewModel.cs

示例9: SetModelLOD0

        protected void SetModelLOD0(MyModel model)
        {
            m_ModelLOD0 = model;
            Flags |= MyElementFlag.EF_AABB_DIRTY;

            //if (GetRigidBody() != null)
            //  MyPhysics.physicsSystem.GetRigidBodyModule().AddActiveRigid(GetRigidBody());
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:8,代码来源:MyRBTriangleMeshElement.cs

示例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);
		}
开发者ID:caloggins,项目名称:DOT-NET-on-Linux,代码行数:9,代码来源:BinaryFormatterExampleTests.cs

示例11: TestSetup

        public void TestSetup()
        {
            backingEntity = new MockModelATableEntity();
            model = new MockModelA(backingEntity);
            propertyManager = model.Property;

            // --

            myBackingEntity = new MyTableEntity();
            myModel = new MyModel(myBackingEntity);
        }
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:11,代码来源:TablePropertyManagerTest.cs

示例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();
     }
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:12,代码来源:MyModels.cs

示例13: ParticleRenderObject

        public ParticleRenderObject(MyModel __model, bool __ShadowCaster,
                                    bool __ShadowReceiver,
                                    bool __Transparent,
                                    bool __SelfIlmn)
        {
            _model = __model;

            isshadowcaster = __ShadowCaster;
            isshadowreceiver = __ShadowReceiver;
            isTransparent = __Transparent;
            isSelfIllumination = __SelfIlmn;
        }
开发者ID:KatekovAnton,项目名称:Game,代码行数:12,代码来源:ParticleRenderObject.cs

示例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;
            }
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:16,代码来源:MyModelOctreeNode.cs

示例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" };
		}
开发者ID:mhusen,项目名称:Eto,代码行数:15,代码来源:Test.cs


注:本文中的MyModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。