WinForms UI validation using attributes as in ASP.NET MVC - winforms

In ASP.NET MVC, we can decorate our properties with validation attributes. Then, this validation is applied at the presentation layer (views, client side) and controller and data access alike.
My question is -can we accomplish this somehow in WinForms?

In the windows forms world, you would use Data Binding, specifically the IDataErrorInfo interfaces and related classes.

Related

Can I use Data Annotations Validation on my POCOs and jQuery validation if I develop the front end in Angular 1 instead of Razor?

Normally when developing in ASP.Net MVC, we put our Data Annotions on our POCOs and use isModel.Valid on the server side and unobtrusive jQuery validation on the front end so we don't have to duplicate and specify our validation requirements twice.
But I am about to try writing my first app with an Angular/Rest SPA architecture (ASP.Net Web API of course, more specifically, ASP.Net MVC Core).
Is there a way to get the Angular Forms to validate against the POCO validation attribute rules and keep it DRY? Or am I going to have to maintain it in both places? Client and Server.
What is the best practice here?
Can someone point me to an example if there is a correct way?

Wpf configuration service like global.asax

I am working on WPF Application.I am using Auto Mapper in WCF services. In My project I have different kind of layer like Service layer, Business Layer , Presentation Layer , I want to work on Service Layer that is (WCF).
In Auto Mapper there is creation of map
Mapper.Initialize(Item=> Item.CreateMap<Model.Person, PersonInfo>());
Mapper.Initialize(Item=> Item.CreateMap<Model.Bank, BankInfo>());
Mapper.Initialize(Item=> Item.CreateMap<Data, Model.DataInfo>());
When ever I call function at that every time it will call as per application perfomance.
I want to make as per global in application.That is Create once in application and use as many time as they can
How to Implement this concept of globalization at service layer in WPF application.
There is no concept of global.asax is WPF Application.then how to implement that concept of globalization of mapper initilization
Thank you.

Import Yii2 validators in angular forms

I am developing an application that uses the yii2 framework to handle data models and angularJS for the frontend counterpart. In some views, I need to handle the input fields with angular forms (i.e., I cannot use Yii2 ActiveForms) but, in this way, I cannot take advantage from the client side validators that the yii2 frameworks offers (the ones that are automatically generated by the ActiveRecords rules). Is there a way to get the Yii2 client side validators and attach them to the angular forms? Any suggestions?

Design decision to migrate Silverlight application

I have a silverlight application, it has pretty complex UI. In some forms I am using MVVM pattern. However there are many forms where code behind file has most of the form logic code (no view model).
Silverlight application is having both business and UI logic. There is a WCF service which SL application is directly calling. This WCF service is a data service (DB logic).
I want to migrate silverlight application into HTML5. I have following questions.
There are many links to migrate the SL application to HTML5 (even using MVVM pattern). Many suggests to use some JS framework library like AngularJS/Knockout. Can you please tell me which one works best for migration from SL?
Where would I put the business logic? Can I write my business logic using JS library? Also in case I write business logic using some library then won't it expose all my logic to client?
In case JS library is not the right thing to write the business logic then what other technology I should use? WebAPI or something else?
Atul Sureka
For Server Side Code Reusablity (MVVM) Code use AngularJS/KendoUI
Use C# Object to JavaScript Object Convrsion
Server Side Logic we can Re-Use, Client Side Logic C# to Java Script
User Rest API's

Sending abstract class with DomainService WCF service to Silverlight

I was using a simple WCF service with silverlight but I wanted to validate data with annotations and I didn't want to write a whole new layer in silverlight project. So I decided to switch to using a DomainService, created through generating code in the silverlight project.
Now comes the trouble. I have a parent class and about 10 derived classes. Through WCF, I was able to just use the base class. Now I am trying to use a DomainService with the base class decorated with the KnownType attribute. The problem is now those attributes get replicated in silverlight client and a compilation error is thrown. Anybody know how to use DomainService with inheritance? I want to deliver only the information from the base class.
I don't completely follow what your problem is, but this is a great tutorial on how to use Domain Services in Silverlight, and the example includes an abstract base class for all entities, similar to what I think you're doing.

Resources