New answers tagged

0

should I show the relationship in the team endpoint like this? There is no particular reason that your resource model should mirror your data model. The question you are asking is a lot like asking "here is my data model; what should my web site look like?". One way to look at that is to pay attention to caching, which is an important REST architectural ...


0

Like all things, that is dependent on your requirements. Both options are valid and reasonable on their own. You haven't provided any detail that would suggest one option over the other. To help with the decision, here are some things to think about: If you are the only consumer of the information, then code to what is most efficient for your needs. If ...


0

For the user it is easier to have a single app for everything, as the users doesn't have to know or remember which app to use for which purpose and doesn't have to switch between apps which may slow down the workflow. For developers, on the other hand, it is easier to have smaller apps that are focused to one central task and they can always share code in ...


1

The most simple and safe solution I can up with is to make FormData an immutable class (so when the form data is shared and passed around between different calculations without copying, there will no side effects, even in a multithreaded context). Then pass one FormData object into the calculation where it makes most sense and reuse this "freezed" set of ...


0

The information you gave is a little sparse but from a very "far away"-point of view I would recommend using multiple controllers. In modern software engineering you should, as a rule of thumb, tend to reduce complexity wherever possible. This helps to fulfill non-functional requirements like: Testability - you can mock data for every controller and every ...


4

There are no hard rules for how to build URLs in REST, only common sense and best practices (here is for example one such guide, out of many). From a REST point of view, it's not important how the URLs look like. Something like /da39a3ee5e6b4b0d3255b is just fine as long as it identifies a resource. In your case, the whole URL is the resource identifier at ...


1

Honestly, you're seriously over-thinking this thing!! The actual requirement is: "get [something] by ([some_field] or All)" Traditionally, this is satisfied by an API which says "get by [field_name]==[value]" where, if the [field_name] and [value] are omitted, it is understood to mean "all." If the [field_name] provided is invalid, then that's simply an ...


0

I think you have a design problem that will lead to inconsistency in your data sources because none of them seems to own the "truth". What happens if I update the email in one of them and update the name in the other? Determining that one of them is the entire truth is very hard to define. There are different solutions to this problem depending on how much ...


0

SWIG - Simplified Wrapper and Generator is the only sane way to do stuff like this. It looks like CppSharp mentioned by @helb is built on top of it. So go for CppSharp, there is no need to reinvent the wheel. I am pointing SWIG out, not just for completeness but because in some cases it may be simpler. I have no experience with CppSharp though. As for C++/...


0

404 == The client has pointed to a "individual"/"concrete" resource that do not exists. That's a client error. 200 == The client has requested to construct a set of "concrete" resources. A set can always be also empty. So even if the collection (query result) is empty, the client hasn't made an error.


-4

Having been down the road of C++/CLI and the pitfalls of having managed code marry up well with unmanaged code I can't recommend enough avoiding the approach of having C++ and C# binaries directly linked. Principally because of the garbage collection, it's hard to ensure a C# object is destroyed, in the sense that it is really destroyed, and will not ...


4

You sure can, and I've done so on both Windows and Mac using .NET Core 3.1, but it will most likely work with .NET Framework as well with minimal modification. The method I used is called DllImport and is describe here: https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.dllimportattribute?view=netframework-4.8#examples Below is an ...


12

For object-oriented APIs, you should consider using a tool which generates a .NET wrapper automatically. Check out CppSharp over on GitHub. Not everything will work automatically but if you are going to wrap 100 classes, it makes sense to generate the bulk of the code needed for interoperation. Whether you are just wrapping a few classes or en entire SDK ...


43

There are various ways to call native code from c# P/Invoke - allows c-style method calls directly from c# code. If the API does not expose c-style (i.e. extern C) functions you will need a wrapper that does this. If the API uses any kind of objects this will probably be an painful approach. C++/CLI - This allows you to use .Net types in a c++ project. So ...


4

With the step 2. you are not creating a token, but just an alias for the user credentials. The real purpose of a token is to get rid of credentials during the client session, since every time the user shows the secret proof of its identity, he/she is exposing the identity itself to attackers. This means that tokens have to be generated "just in time", ...


2

If you want to go the route you described I would recommend looking into this: https://winsmarts.com/access-tokens-and-refresh-tokens-and-id-tokens-5261bc26e8a2. Also look into OAUTH 2 and OIDC. But I agree with the previous comment, it is best to use a vetted library than it is to make your own. Furthermore I must caution you with JWT. Those tokens are ...


1

The first rule of securing your system is not to write the security part yourself. You need to delegate the security of your system to other third-party libraries or even services. However, regarding your draft, you must generate the token when your user logged in as opposed to when they first created the account. The token has to have a short lifespan. You ...


1

At a high level, this is a fairly simple architecture. You have something (we'll call it the Writer) which sends a message to something else (which we'll call the Scheduler). With the message is a time that the Writer wants the Scheduler to forward that message on to an action taker to do something with. You haven't mentioned the Writer, so I assume you ...


0

Although I'm sure it will be possible in Azure insights, it does charge us for usage. That is fine since it can provide a lot of statistics. But because we only want just a small amount of information, we've created middleware that does collect the data and writes that to our database. For now this is sufficient.


Top 50 recent answers are included