• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MyModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MyModel的典型用法代码示例。如果您正苦于以下问题:C# MyModel类的具体用法?C# MyModel怎么用?C# MyModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MyModel类属于命名空间,在下文中一共展示了MyModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: StorageHelperSaveTest

    public async Task StorageHelperSaveTest(StorageSerializer serializerType)
    {
      var myObject = new MyModel() { Name = "Michiel", Age = 29 };

      IStorageHelper<MyModel> sh = new StorageHelper<MyModel>(StorageType.Local, serializerType: serializerType);

      await sh.SaveAsync(myObject, "myfile");

      var loadedObject = await sh.LoadAsync("myfile");

      Assert.AreEqual(myObject.Name, loadedObject.Name);
      Assert.AreEqual(myObject.Age, loadedObject.Age);

      await sh.DeleteAsync("myfile");

    }
开发者ID:angusbreno,项目名称:Q42.WinRT,代码行数:16,代码来源:StorageHelperTest.cs


示例17: InitPrefab

        protected override void InitPrefab(string displayName, Vector3 relativePosition, Matrix localOrientation, MyMwcObjectBuilder_PrefabBase objectBuilder, MyPrefabConfiguration prefabConfig)
        {
            MyMwcObjectBuilder_PrefabAlarm objectBuilderAlarm = objectBuilder as MyMwcObjectBuilder_PrefabAlarm;
            MyPrefabConfigurationAlarm alarmConfig = prefabConfig as MyPrefabConfigurationAlarm;

            m_modelLod0On = MyModels.GetModelOnlyData(alarmConfig.ModelLod0EnumOn);
            if (alarmConfig.ModelLod1EnumOn != null)
            {
                m_modelLod1On = MyModels.GetModelOnlyData(alarmConfig.ModelLod1EnumOn.Value);
            }
            m_modelLod0Off = m_modelLod0;
            m_modelLod1Off = m_modelLod1;

            Flags |= EntityFlags.EditableInEditor;
            InitLight();
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:16,代码来源:MyPrefabAlarm.cs


示例18: StorageHelperDeleteTest

        public async Task StorageHelperDeleteTest()
        {
            var myObject = new MyModel() { Name = "Michiel", Age = 29 };

            StorageHelper<MyModel> sh = new StorageHelper<MyModel>(StorageType.Local);

            await sh.SaveAsync(myObject, "myfile");

            //Delete saved object
            await sh.DeleteAsync("myfile");

            var loadedObject = await sh.LoadAsync("myfile");
            Assert.IsNull(loadedObject);


        }
开发者ID:vigneshmurugesan,项目名称:Q42.WinRT,代码行数:16,代码来源:StorageHelperTest.cs


示例19: LoadContent

        private static List<Vector3> m_verticesBuffer = new List<Vector3>(2000);   //max capacity of rendered lines



        public static void LoadContent()
        {
            MyMwcLog.WriteLine("MySimpleObjectDraw.LoadContent() - START");
            MyMwcLog.IncreaseIndent();

            m_modelBoxHiRes = MyModels.GetModelForDraw(MyModelsEnum.BoxHiRes);
            m_modelBoxLowRes = MyModels.GetModelForDraw(MyModelsEnum.BoxLowRes);
            m_modelSphere = MyModels.GetModelForDraw(MyModelsEnum.Sphere);
            m_modelLightSphere = MyModels.GetModelForDraw(MyModelsEnum.Sphere_low);
            m_modelCone = MyModels.GetModelForDraw(MyModelsEnum.Cone);
            m_modelHemisphere = MyModels.GetModelForDraw(MyModelsEnum.Hemisphere);
            m_modelHemisphereLowRes = MyModels.GetModelForDraw(MyModelsEnum.Hemisphere_low);
            m_modelCapsule = MyModels.GetModelForDraw(MyModelsEnum.Capsule); 

            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MySimpleObjectDraw.LoadContent() - END");
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:21,代码来源:MySimpleObjectDraw.cs


示例20: Registration

 public ActionResult Registration(LoginRegister U)
     {
         if (ModelState.IsValid)
         {
             using (MyModel db = new MyModel())
             {
                 db.Users.Add(U.users);
                 db.SaveChanges();
                 ModelState.Clear();
                 U = null;
                 ViewBag.Message = "Successfully Registration Done";
                 return RedirectToRoute("Home");
             }
         }
         return View();
     
     }
开发者ID:Azcanban,项目名称:Hospital-Website-.net,代码行数:17,代码来源:UserController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MyMouseButtonsEnum类代码示例发布时间:2022-05-24
下一篇:
C# MyMissionBase类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap