Shimmy on .NET
Ideas and thoughts about .NET and related geeky material by Shimmy Weitzhandler
Sign in
|
Join
|
Help
Home
Contact
About
RSS
Atom
Comments RSS
Search
Tags
.NET
.NET 4
ADO.NET
ASP.NET MVC
C#
char
Code-First
DataAnnotations
DatabaseInitializer
Data-Binding
Date
DbContext
Designer
DEV
Dictionary
dynamic
Eager Loading
EDM
EF
Entity Framework
Entity Framework 4.1
Enum
Event
Expression Tree
Extension Methods
Garbage-Collector
GC
Generics
hardcoded
Hebrew
icloneable
IDictionary
IMarkupExtension
Include
IsNull
Jewish
LINQ
markupextension
Model-First
MVVM
My Namespace
Nullability
ObjectContext
ObjectQuery
ObservableDictionary
OFFTOPIC
Performance
Prism
Readability
Reflection
RequiredAttribute
RIA
RIA-Services
Silverlight
Silverlight-4
Silverlight-5
SQL
SQLCE
SQL-Compact
StaticExtension
string
Strongly-typed
Text
Tip
Type-Arguments
UniqueAttribute
Validation
ValidationAttribute
VB.NET
VB10
ViewModel
Views
Visual-Studio-2010
VS2010
VSIX
Window
winrt
WPF
XAML
News
Navigation
Home
All Posts
RSS
Popular Tags
Archives
May 2012 (2)
March 2012 (2)
February 2012 (2)
January 2012 (4)
October 2011 (1)
May 2011 (2)
April 2011 (1)
March 2011 (2)
December 2010 (2)
September 2010 (1)
August 2010 (3)
January 2012 - Posts
2
Comments
Congratulations! We had a new babygirl!
by
Shimmy
Hi everyone! We just a had a very cute babygirl! Hope to post some photo any time soon...
תגים:
OFFTOPIC
4
Comments
ValidationAttribute that validates a unique field against its fellow rows in the database
by
Shimmy
UPDATE: Jan 30 2012 : Added check that entity is not itself (i.e. when user attempts to save the same entity). UPDATE: Feb 26 2012 : Added support for inherited entities, where the validated property is on the sub-class of the inheritance hierarchy. Here is a ValidationAttribute subclass that will allow you to validate that a column doesn't have duplicates. It's intended to be used with EF 4.1 DbContext , or with the EF4's ObjectContext . namespace System . ComponentModel . DataAnnotations...
תגים:
Entity Framework
,
DEV
,
DataAnnotations
,
ValidationAttribute
,
RIA
,
RIA-Services
,
Validation
,
DbContext
,
Entity Framework 4.1
,
ObjectContext
,
UniqueAttribute
2
Comments
Determine if char is Hebrew
by
Shimmy
Simple Ex. method: // avoid unicode chars in code private const char FirstHebChar = ( char )1488; //א private const char LastHebChar = ( char )1514; //ת private static bool IsHebrew ( this char c ) { return c >= FirstHebChar && c <= LastHebChar ; } Note: a comment bellow noted that the above function solely checks for hebrew characters within the א-ת range, it won't include punctuation marks, vowels or other biblical symbols. For a function that covers all (all that I'm aware...
תגים:
C#
,
DEV
,
.NET
,
Text
,
Hebrew
,
char
,
string
0
Comments
Enum.IsDefined for combined values not declared in the enum body
by
Shimmy
When you try to determine if an Enum value is defined in an Enum, it returns true only if the flags you've combined are explicitly declared in the Enum. Consider this Enum: [ Flags ] // Enum defined with a FlagsAttribute attribute. enum Hue : sbyte { Black = 0, //no color Red = 1, Green = 2, Blue = 4, Cyan = Green | Blue , //6 Magenta = Red | Blue , //5 BadColor = 127 } The following line will return false: var white = Hue . Red | Hue . Blue | Hue . Green ; //7 Even tho theoretically the enum...
תגים:
C#
,
DEV
,
.NET 4
,
dynamic
,
Enum