Blame it on the Romans
http://www.slate.com/id/2159747/
<endpointBehaviors>
<behavior name=”AspNetAjaxEndpointBehavior”>
<enableWebScript/>
<dataContractSerializer maxItemsInObjectGraph=”2147483647″ />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name=”AspNetAjaxBinding” hostNameComparisonMode=”StrongWildcard” closeTimeout=”00:01:00″ openTimeout=”10:01:00″ receiveTimeout=”10:10:00″ sendTimeout=”10:01:00″ maxBufferPoolSize=”2147483647″ maxReceivedMessageSize=”2147483647″ bypassProxyOnLocal=”false”>
<readerQuotas maxDepth=”2147483647″ maxStringContentLength=”2147483647″ maxArrayLength=”2147483647″ maxBytesPerRead=”2147483647″ maxNameTableCharCount=”2147483647″/>
<security mode=”TransportCredentialOnly”>
<transport clientCredentialType=”Ntlm” />
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name=”Namespace.Classname” behaviorConfiguration=”ProxyServiceBehavior”>
<endpoint address=””
binding=”webHttpBinding” bindingConfiguration=”AspNetAjaxBinding”
contract=”IInteface” behaviorConfiguration=”AspNetAjaxEndpointBehavior” />
</service>
</services>
Common Date Time utility functions for figuring out start (first) dates
Week:
public static DateTime GetWeekStartDate(DateTime dDate) {
DayOfWeek day = dDate.DayOfWeek;
int days = day – DayOfWeek.Sunday;
DateTime start = dDate.AddDays(-days);
return start;
}
Month:
public static DateTime GetMonthStartDate(DateTime dDate)
{
int month = dDate.Month;
DateTime start = new DateTime(dDate.Year, month, 1);
return start;
}
Quarter:
public static DateTime GetQuarterStartDate(DateTime date)
{
int intQuarterNum = (date.Month – 1) / 3 + 1;
return new DateTime(date.Year, 3 * intQuarterNum – 2, 1);
}
if(obj.expirationdate > somedate && obj.effectiveDate<somedate)
{}
use a simple extension method for your obj and you would have
if(obj.IsValidForDate)
{}
I was reading this article on the net http://www.artima.com/weblogs/viewpost.jsp?thread=71730 and basically the author say if one of the items in the below are true, then our code sucks and I agree 🙂
1) Your code sucks if it isn’t testable.
2) Your code sucks if it’s hard to read.
3) Your code sucks if it’s not understandable.
4) Your code sucks if it dogmatically conforms to a trendy framework at the cost of following good design/implementation practices.
5) Your code sucks if it has duplication.
KnownType: if you use this at the base class level everything will work as expected
ServiceKnownType : one of the issue with serviceknowntype is that if you decorate it at the service implementation level(class) or the method implementation, it does not have any effect, the compiler does not throw any error, but during runtime the client call will fail(underlying connect closed), the solution is to always use the ServiceKnownType attribute on the service interface or the method in the interface.
private static void InvokeBtsTask(string taskParams)
{
System.Diagnostics.Debug.WriteLine(string.Format(” Begin BTSTask with params {0}”, taskParams));
StringBuilder taskOutput = new StringBuilder();
Process btsTask = new Process
{
StartInfo =
{
FileName = “BTSTask.exe”,
Arguments = taskParams,
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
CreateNoWindow = true
}
};
btsTask.Start();
while (btsTask.StandardOutput.Peek() > -1)
taskOutput.Append(btsTask.StandardOutput.ReadToEnd());
btsTask.WaitForExit();
System.Diagnostics.Debug.WriteLine(string.Format(“BTSTask exited with message {0}”, taskOutput.ToString()));
System.Diagnostics.Debug.WriteLine(string.Format(” End BTSTask with params {0}”, taskParams));
if(!taskOutput.ToString().Contains(“Command succeeded with 0 errors, 0 warnings”))
throw new ApplicationException(String.Format(“Error while executing BTSTask.exe with parameters {0} error message {1}”,taskParams,taskOutput.ToString()));
}
in a nut shell what does it do, configures service bus endpoints…..
you can pretty much do the same through the config entries, well these are just my thoughts…
config sections for a wcf service…