I think the WPF model concept is where I was initially coming from, as that still seems a good idea for a Blazor wasm app. Even if the V/VM part is a little different. The webapi (or a service behind that) can do the translation between what I want to show and EF or any other database interaction.
cjb110
Posts
-
Data Class for data combined from Other Classes -
Data Class for data combined from Other ClassesI'd like a bit of help with terminology/practices around models and DTO's. If it makes any difference to the answer, this is a blazor client/webapi server in C#, and there will be a database ORM (likely EF) at some point. I've got some simple plain object classes that I've been calling Models, and each of these contain the properties for one 'thing' in my application. Now one part of my UI wants to display data from multiple of these model classes. Now I'm pretty sure you don't want to get all of data from each model and combine on the UI. I'm also pretty sure I can't transfer an anonymous type over a webapi call? Or at least I couldn't easily work with it if I did. So I think I want to create a second class that has the properties from both the parent classes I want to use, the server part does the combining and transfers that class. So is this combined class more commonly referred to as a DTO? and that for ease of understanding I should separate that from my main model classes? Also if I do just want all the data from a model class, I dont need to create a seperate DTO just for that, and its ok to just reuse the model class? thanks
-
Browser-based Document Scanning ApplicationWell the other solution could be that the user installs a local piece of software, that in effect connects to a 'control' server and connects to the locally connected scanner. Then a separate web site 'could' send a message to the control server which then would tell the local software to act. But note that whole interaction makes no sense, far to much of the process is the user interacting with the physical scanner. So controlling 'remotely' via web sites doesn't help the process at all. Now if your actual concern is that the 'scanning, file, upload file to your site' etc process isn't as easy as it could be. Then yes I could understand that, but the solution would be a downloaded piece of software that interacts with all scanner types, scans and uploads the file to just your servers. I think most people hitting this concern have decided its better to educate (via the websites) the users on how to do the process rather than solve it with software.
-
Minimize the risk that (bad) programmers call specific functions?Don't expose the functions as public then? They should only be seeing the public interfaces you want them to see. Also start to employ more defensive programming with in those functions, validate all the incoming parameters, and fail early and often if they're not within the spec. If its function order then maybe you could add a audit type layer, so you can ensure function x is called after function y. Generally though, why would they call a function they don't need? If they're calling it from the GUI then surely there's a spec that says that's what the GUI needs to do? And your driver should be providing a safe method for that?
-
Browser-based Document Scanning ApplicationIf your intending for a user to go to a third-party website and the site somehow controls a scanner they may or may not have, then that's a deadend. That goes against everything a browser is supposed to do. Your site should direct them to upload the scanned file, but the actual generation is in the users hands...obviously your site could provide guiding instructions. If your creating a scanner client and just want to use HTML for the interface, that's doable.
-
Architectural GuidanceWe're a small internal dev team and we have an .NET & AngularJS web site, except the site is supposed to act as a host of other sites/applications. So the users go to a single address, they can then get to the other apps via a dashboard, but the core site handles the 2 different authentications (windows and custom oracle database based) and other common features. Currently the .NET side is all separate projects for each app. The AngularJS is just one app. Ideally we'd want the applications to be more independent, so that we could update one and be comfortable saying that regression testing of the others isn't needed. Some guidance on: How would you design the web side? I was thinking separate angular apps with the 'host' site using iframes? As I couldn't think of another way to keep the whole look and feel with out code duplication. The authentication, its OAuth/Owin, the windows AD and Oracle are separate, but the same user could have creds for both. We've currently got two 'client_ids' in the single web app, which doesn't seem right, as I'm tracking two access_tokens. I'm thinking I could use OAuth claims instead. We are also planning rewriting from AngularJS, would anyone recommend an alternative framework? I'm half thinking of Blazor, to reduce the number of languages the team needs to know, but obviously its still new, so the amount of resources about and its long term viability are risks. Apologies for the rambling post:)
-
Object Type and HTTP JSON GetsI've been struggling with getting an Angular 6 app to sort the results of an WebAPI call, and it turns out that the root cause is case sensitivity on the object properties. And I can see 'where' the differing cases come from, but I can't see the where/why. I have a class for my object:
export class App
{
id: number;
name: string;
description: string;
isEnabled: boolean;
shortName: string;
displayOrder: number;
}And my web service returns JSON like:
{"ID":1
,"Name":"Matterhorn User Management"
,"Description":"User and Role management for Matterhorn applications."
,"IsEnabled":true
,"ShortName":"MUM"
,"DisplayOrder":10}To retrieve the data I've got the following function in my service:
getApplications(): Observable
{
let apiURL: string = this.baseUrl + 'usermanagement/applications/read';return this.http.get(apiURL);
}
And finally my component calls that service function:
getApps(): void
{
this.appsService.getApplications()
.subscribe(data =>
{
this.apps = data.sort((a, b) => a.DisplayOrder - b.DisplayOrder);
});}
So the problem was that
data
structure matches the JSON capitalization and not my local TS object one, and I had to useDisplayOrder
notdisplayOrder
(and TS now whinges at me). But isn't Angular now supposed to map and convert JSON automatically (I know this was a specific step in the past)? And surely your local objects don't have to match the case sensitivity of the JSON provided by others. -
Visual Studio - how to make #region stay on leftre #if, does that not make sense though? Its not supposed to be part of the normal flow, you want it to really stand out.
-
Fixing a Broken InterceptorWe're developing a Angular 1 site that talks to a .NET WebAPI2 api. We have an interceptor related to the authentication side, but we're having problems with it. We are using a loading bar Angular component, and that component is reporting that the interceptor is broken. But we're not sure where/why and worse where to start investigating. By simple code elimination, the _request method seems to be ok (or at least doesn't cause issues, it might still be bad code!) Its the _responseSuccess method that causes the problem.
'use strict';
app.factory('authInterceptorService', ['$injector', '$q', '$location', 'localStorageService', function ($injector, $q, $location, localStorageService)
{var authInterceptorServiceFactory = {}; function RequiresRefresh(responseURL) { if (responseURL.indexOf('getcutofftime') > -1) return false; if (responseURL.indexOf('resources') !== -1) return true; return false; } var \_request = function (config) { config.headers = config.headers || {}; var authData = localStorageService.get('authorizationData'); if (authData) { config.headers.Authorization = 'Bearer ' + authData.token; } return config || q$.when(config); }; //should handle all error responses in here. //var \_responseError = function (rejection) //{ // console.log("Intercepted Rejection: " + rejection); // return $q.reject(rejection); //}; var \_responseSuccess = function (response) { var responseURL = response.config.url; if (responseURL !== null && typeof responseURL !== 'undefined') { //check to make sure it's actually an interaction with the resourcesAPI - these are the only times it should refresh the token. if (RequiresRefresh(responseURL)) { //get a new token! var authData = localStorageService.get('authorizationData'); var JSONdata = { windowsFullName: authData.windowsFullName , windowsUserName: authData.windowsUserName , summitUserName: authData.summitUserName , summitFullName: authData.summitFullName , clientID: 'MatterhornAuthApp' }; $injector.get("$http") .post(serviceBase + 'usermanagement/account/ReissueToke
-
LinkedIn told it cannot stop the botsThis is a good result tbh, you can't put information on the public internet the complain when it gets read. Just because it was read by a computer program is irrelevant.
-
Arrrgh...another PC bites the dustWhy raid 0 the ssd's? Please don't say for performance! Also double check your PSU has the right CPU power connectors for these new mobo's. It probably does have them but worth checking first. Oh and 4 years is a massive amount of time for a socket, doubt 2066 will last much longer!
-
Password managersYey, to LastPass. Simple enough to use, with cross platform support. Occasionally OTT with some of the security requirements, and not sure it really gets having multiple concurrent devices in use but otherwise really like.
-
Apple's Tim Cook asked President Trump for coding requirement at US schools - reportCoding shouldn't be mandatory, but computer usage should be. The more global issue is that the number of workers using computers but not understanding the basics of how they work and what they can and cant do. This should include the internet as well.
-
Viva, Visual Basic! Or, does VB have a future?I thought this was about VBA:( VB.NET is entirely pointless.
-
Don't tell people to turn off Windows Update, just don'tAgreed, unfortunately MS has a image problem with Windows Update, and they've not solved it. What is worst is that technically minded people are still perpetuating a lot of BS about Windows Update. Windows 10 update has very few issues, it doesn't interrupt, it doesn't bug. Maybe if you never restart your PC you might have a few more issues, but for the vast majority you will hardly notice it doing its job. Even the latest creators update was clear and straightforward, you couldn't really tell it basically done an whole OS update.
-
URL ShorteningTwitter is one, but it arrived before that mainly for mobiles, its still not as easy as it should be to quickly easily transfer a link to/from mobile to other devices, a 6/8 character URL is far easier to type than some of the monstrosities that appear. Finally some sites still seem to embed War & Peace in the URL, so even ignoring mobiles, URL shorteners are useful.
-
VS2017 Hates MePre-existing install? They did say RC-Live was ok, but maybe other Xamarin installs causes issues.
-
Tales from the CryptI assume this is from a older codebase that was blindly converted to .NET, I can't imagine anyone the knows they should use StringBuilder but not that Padding strings is built into to .NET.
-
Netflix on Non-Smart TVI'd say the Amazon Fire series, it allows access to both Netflix and Amazon's Prime Video, (as well as other smaller providers) and as Amazon aren't playing nice with Android in general, this is the easiest way to get the option to have both major platforms. Chromecast is a bit fiddly, needing a separate device to operate (the fire comes with a remote) Android TV (e.g. the Nvidia Shield) is better than the Chromecast for a living room, but again no Amazon access.
-
i and jIf you took the Fortran IJKLMN, are the letters in the same order when translated to eastern languages? That may explain why your typically using n/m.