Hourly, Daily, Monthly Helper+Model methods

You can create daily,monthly and yearly data by using the same logic. You just have to replace Hour with Day,Month or Year. List<dynamic> dailyData = new List<dynamic>(); DateTime dayIterator = StartDate.Value; while (dayIterator.Hour <= ddvm.CurrentDay) { if (ddvm.DailyPaymentTotal != null && ddvm.DailyPaymentTotal.Count() > 0 ) { DailyPaymentTotalModel day = ddvm.DailyPaymentTotal.FirstOrDefault(hpt => hpt.DateTimeStamp == dayIterator); if … Read more

C# first class continuation via C++ interop or some other way?

There is the C# 5 CTP, which performs a continuation-passing-style transformation over methods declared with the new async keyword, and continuation-passing based calls when using the await keyword. This is not actually a new CLR feature but rather a set of directives for the compiler to perform the CPS transformation over your code and a … Read more

WPF Attached Events vs Non-Attached Events

The difference is mostly syntactic, both delegate references are being handled by WPF’s EventManager but what the attached events give you is the ability to declare generic functionality without needing to bloat all your classes’ implementation. In the case of a normal routed event, the class provides the interface to be able to at some … Read more

Is it possible to combine [FromRoute] and [FromBody] in ASP.NET Core?

It’s doable by a custom model binder as mentioned in the comment. Here is a few code snippets to wire everything up, with the example you can send a http request with the following JSON body to an API /api/cats?From=james&Days=20 { “Name”:””, “EyeColor”:”Red” } A few classes, you can find them here as well: https://github.com/atwayne/so-51316269 … Read more

Extended UIButton border is not initially drawn

This works public class MyButton : UIButton { public MyButton() : base(UIButtonType.RoundedRect) { } public override RectangleF Frame { get { return base.Frame; } set { var temp = TranslatesAutoresizingMaskIntoConstraints; TranslatesAutoresizingMaskIntoConstraints = false; var constraints = new [] { NSLayoutConstraint.Create(this, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1.0f, value.Width), NSLayoutConstraint.Create(this, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1.0f, value.Height) }; AddConstraints(constraints); … Read more

C# has abstract classes and interfaces, should it also have “mixins”?

The problem you describe could be solved using the Visitor pattern (everything can be solved using the Visitor pattern, so beware! ) The visitor pattern lets you move the implementation logic towards a new class. That way you do not need a base class, and a visitor works extremely well over different inheritance trees. To … Read more

Why could COM interop layer be 40 times slower when client is compiled in VS 2010 vs VS 2005?

It was kind of a long shot. Glad I could help. Matching MTA vs STA (threading model) is really important when making lots of distinct calls into any COM object. An [STAThread] directive at the top of a method is one way to be sure of threading model for every call in that method. Looks … Read more

Updatable Views in Entity Framework 5/6

I would think that your easiest method, would be to change the definition of your EntitySet in your StorageModel to tell it to regard it as a table, as opposed to a database-view. Looking at the XML definition, where it says <EntitySet Name=”Products” store:Type=”Views” .. you change that to <EntitySet Name=”Products” store:Type=”Tables” .. (Note the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)