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
ADO.NET
C#
Cast
Convert
DataAnnotations
Date
DbContext
DEV
Dictionary
EDM-Designer
EDMX
Entity Framework
Entity Framework 4.1
Entity Framework 5.0
Expression Tree
Extension Methods
Hebrew
ICloneable
IDictionary
Jewish
LINQ
MVVM
ObservableDictionary
OFFTOPIC
Prism
RIA
RIA-Services
Silverlight
Silverlight-4
Silverlight-5
SQL
SQLCE
string
Text
Type-Conversion
Unique-Constraint
ValidationAttribute
VB.NET
VB10
View
ViewModel
Visual-Studio-2010
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
6
Comments
UniqueAttribute that validates a unique field against its fellow rows in the database (inherits DataAnnotations.ValidationAttribute)
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
,
DbContext
,
Entity Framework 4.1
,
Entity Framework 5.0
,
Unique-Constraint
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
,
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