Tag Info

New answers tagged

1

I think that the advantages of this approach far, far outweigh any disadvantages. What you're achieving here is more ore less a perfect "implementation" of the I in SOLID by way of the Stairway pattern - that is to say, your application depends "down" on an interface defined in Company.Framework.Persistence.dll and the individual implementations themselves ...


1

Or maybe it`s simply a mistake. for instance you can eather inherit from 1) FilterAttribute, IActionFilter Or 2) ActionFilterAttribute the first on provids low level behaviour of MVC Attributes plus Order and AllowMultiple properties. and the second one provides less details plus OnResultExecutingand OnResultExecuted capabilities.


0

The advantage of strategy two is to minimize dll hell. Usually Company.Framework.Persistence.MySQL.dll will depend on some dll for interfacing with MySql. If I have no interest in MySql, Why should I download the dll from MySql? Lets say your framework supported 20 different storage providers. Most users only use one. So all users have to go and get 19 ...


1

I do it that way too. Projects/dlls are essentially free and make the code more readable and easier to use. I have known people use a single large DLL and differentiate with name spaces. But as you say they have to deploy unused code, I don't see any benefits to the practice and many downsides such as change to one implementation requires recompile of ...


1

Code should not be environment aware, that's why we have configs. Also, you usually do not want to ship your code with development secrets (DB connection string, etc.). Or sometimes it is not desirable to give developers access to the production secrets. Although it's a typical task in programming, to have separate configurations for different environments, ...


1

A classic problem - the simplest resolution is to do what everyone does, treat your Core product as a separate product, similar to how you'd treat an open source project you were reusing in your product. For example, I use log4net in my product. I don't have a copy of their source, I only take the latest stable dll and use that directly, putting it in a ...


0

The repo location on the file system should not cause issues with the path to projects in the solution files. The latter should only depend on the locations of the working copies - maybe you mixed that up? However, if I have to guess what's really going on, the solution to your problem is probably: relocate your projects so all references are relative paths ...


0

Here is what I came up with: The Flags attribute way consisted of several tricky pitfalls. For example, bit shifts on signed ints are arithmetic so the sign bit can't be easily used. Also, reconstructing the array of flags from a bitmask can get really mess, as blorgbeard mentioned. Instead, I used the System.BitArray class which which is easily accessible ...


1

Expanding on @Telastyn's answer, you can declare your flags as an enum with the Flags attribute instead of using an array of booleans: [Flags] public enum Options : uint { Empty = 0, FancyClouds = 1, EnhancedGrassTextures = 2, HiDefNoses = 4, NoPantsMode = 8, // etc. values are increasing powers of 2 up to 2^31 } You can fiddle ...


3

Yes, there is a Flags attribute that lets you use enums as flags for an int, and the type has methods to help identify if a flag is set and the such.


8

First I don't like using IDisposable on actual collection. It muddles the actual meaning of Disposable. I would do it like this: public class CollectionUpdateContext<T>: IDisposable // can also be inner class of custom collection { public CollectionUpdateContext(ObservableCollection<T> inner) { inner.BeginUpdate(); } ...


1

Just to clear up a few things that are well documented in the official Rx Design Guidelines and at length on my web site IntroToRx.com: You dont rely on the GC to clean up your subscriptions. Covered in detail here There is no Unsubscribe method. You subscribe to an observable sequence and are given a subscription. You can then dispose of that subscription ...


1

So far nobody in this question seems to have picked up on the real reason for this naming convention. A DirectoryInfo is not the directory. It is a DTO with data about the directory. There can be many such instances describing the same directory. It is not an entity. It is a throw-away value object. A DirectoryInfo does not represent the actual directory. ...


1

ThingInfo can serve as a great read only Proxy for the Thing. see http://www.dofactory.com/net/proxy-design-pattern Proxy: "Provide a surrogate or placeholder for another object to control access to it." Typically the ThingInfo will have public properties with no setters. These classes and the methods on the class are safe to use and will not commit any ...


0

Take a look at the StackTrace and StackFrame objects in the System.Diagnostics namespace. They may be able to help log out information that is desired. When an exception occurs the stack trace in the exception is captured in a similar manner. It sounds like you want to log non-exception situations as well, so this may help as one can get the stack and ...


0

Since users will be somehow authenticated during usage, you could "flag" trial accounts status and keep track of their activity: User A logs in. User A performs an action against the service A combination of the user ID + timestamp is tracked Check the earliest timestamp associated with the same user ID IF the check passes (the earliest and the current are ...


0

You are correct in that you cant ensure logout with a web application, where you essentially download a client program and then make intermittent requests for data the server. There are a few work arounds for this problem that I know of 1: define 'logged out' as automatically occurring after a period of inactivity This may not be best for you with such ...


-1

I suppose that with this number of users it is not hosting but dedicated servers where you can install everything you need to your service. If it is right my suggestion is to use some external storage like Redis where login token (or other user identifier that passed from client to server) will be the key and value is all data you want to know about the user ...


4

Iterating through a List is (slightly) slower than a plain array due to a few factors: Bounds checks: This is likely to be the biggest factor; every single indexer access to the List is going to do a bounds check. Bounds checking on a raw array can often be trivially optimized out of a loop by the JIT. Method call costs: The indexer on a List is a method ...


0

We use RAML which is a formalized format to describe your REST services using YAML. Example: title: World Music API baseUri: http://example.api.com/{version} version: v1 traits: - paged: queryParameters: pages: description: The number of pages to return type: number - secured: !include ...


0

My question is then, how do I know specifically which classes need to be disposed? You could look into the MSDN documentation for each class. That would be boring and cumbersome, but work. If you are using a Visual Studio version that supports it, you should turn on Static Code Analysis in the options of your project. It will give you a warning for ...


2

I would say that context/domain matters, since we have high level business logic code and low level models, architecture components and so on... 'Info', 'Data', 'Manager', 'Object', 'Class', 'Model', 'Controller' etc. can be smelly suffixes, especially on a lower level, since every object has some information or data, so that information is not necessary. ...


2

Considering the actual devices (sensors and receivers) are one thing, and their representation in software is another, I am thinking about naming some classes with the "Info" suffix name pattern. For example, while a Sensor would be a class to represent the actual sensor (when it is actually connected to some working device), SensorInfo would be used ...


2

In general, an Info object encapsulates information about an object's state at some moment in time. If I ask the system to look at a file and give me a FileInfo object associated with its size, I would expect that object to report the size of the file at the time the request was given (or, to be more precise, the size of the file at some moment between when ...


1

For a database design, all one needs is the left, operator, and right. Something like this: X > 10 A table like this: RuleSetID PropertyName Operand TargetValue 1 Weight LessThan 200 Then one can use System.Linq.Expressions namespace to dynamically create expressions for evaluation. For more information on this .Net ...


1

Whether or not you need to use a unit testing framework is up to you. Any dependency will need to be faked so that logic can be tested in isolation. With legacy code where the dependencies are not visible a mocking or faking framework can help expose those dependencies for you and replace them so you can test that code easily without major refactoring. In ...


15

I think "info" is a misnomer. Objects have state and actions: "info" is just another name for "state" which is already baked into OOP. What are you really trying to model here? You need an object that represents the hardware in software so other code can use it. That is easy to say but as you found out, there is more to it than that. "Representing ...


10

It may be a little difficult to find a single unifying convention here because these classes are spread out over a number of namespaces, (ConnectionInfoseems to be in CrystalDecisions, and DeviceInfo in System.Reporting.WebForms). Looking at these examples, though, there seem to be two distinct uses of the suffix: Distinguishing a class providing static ...


2

As much as I am an amateur in such situations as these, it seems that an appropriate and well constructed argument is required to justify to the heads of departments a need for the extra expense (and expanse) of the IT resources. You probably want a good speaker who is able to intermediate the issues and relate the potential value of the proposal to those ...


2

Does it mean that F# can be used like unmanaged code similar to C++ and C? Theoretically, yes. Practically, no. Languages often don't specify how they're compiled. There's nothing precluding you from taking the syntax and semantics of Java or C# and have them compile down directly to x86 assembly and avoid the need for the JVM or .NET runtime. That ...


1

It might be okay. A problem with your example is that you use such example-ish names. Consider: SomeMethod(long longNum) { int num = (int)longNum; /* ... */ Now, when you've a good idea what a long and int means, then both the implicit cast of int to long and the explicit cast from long to int are quite understandable. It's also understandable how 3 ...


0

None of the other answer have it right in my humble opinion. In this stackoverflow quiestion the highest votes answer argues that mapping code should be kept out of the domain. To answer your question. No your usage of the cast operator is not great. I would advise to make a mapping service which sits between your DTO and you domain object, or you could use ...


6

There is a very strong convention that casts on mutable reference types are identity-preserving. Because the system generally does not allow user-defined casting operators in situations where an object of the source type could be assigned to a reference of the destination type, there are only a few cases where user-defined casting operations would be ...


10

While I can see why you would need to have a SmallObject, I would approach the problem differently. My approach to this type of issue is to use a Facade. Its sole purpose is to encapsulate BigObject and only make available specific members. In this way, it is a new interface on the same instance, and not a copy. Of course you may also want to perform a ...


74

It is... Not great. I've worked with code that did this clever trick and it led to confusion. After all, you would expect to be able to just assign the BigObject into a SmallObject variable if the objects are related enough to cast them. It doesn't work though - you get compiler errors if you try since as far as the type system is concerned, they're ...


1

Using IXmlSerializable There are some things to take into consideration when implementing this interface and you should check to see if your intended use is compatible with this. Big advantage of this approach is that you can serialize what are otherwise private or protected fields, and the fairly straightforward usage of serialization (method on the object ...


1

Yes, from what I understand the .NET regex flavor has not changed since 1.0.


1

I agree that web app must be the only one accessing mysql. So web app must inevitably provide some sort of api that let your public web api access relevant data. This API is a contract between web app and mysql that allow them to be developed separately without breaking. The complexity and flexibility of this API must reflect your business needs but keep ...



Top 50 recent answers are included