DCSIMG
November 2007 - Posts - Guy Burstein's Blog

Guy Burstein's Blog

Developer Evangelist @ Microsoft

News

Guy Burstein The Bu

Disclaimer
Postings are provided 'As Is' with no warranties and confer no rights.

Guy Burstein LinkedIn Profile

November 2007 - Posts

Slide Decks and Demos from LINQ to SQL Session at Developer Academy 2

Slide Decks and Demos from LINQ to SQL Session at Developer Academy 2

I gave a session about LINQ to SQL in the Developer Academy 2 conference. From the feedback I got, it seems that the audience had good time and went away with valuable knowledge about LINQ to SQL. I personally had a great time and was very excited all day long.

 Guy Burstein LINQ to SQL Guy Burstein LINQ to SQL Guy Burstein LINQ to SQL

You can find the slide decks and demos from the session in my presentations page.

If you have any feedback about the session, I'd like to hear it!

Enjoy!

עוזב את אדוונטק

לאחר תקופה ארוחכה של מחשבות, התלבטויות והתייעצויות, החלטתי לסיים את עבודתי באדוונטק ולהמשיך הלאה לדבר הבא.

את דרכי בחטיבת מיקרוסופט של אדוונטק (מגן, לשעבר) התחלתי למעשה לפני כ- 6 שנים, בתור חייל ביחידת מחשב שבאה לבצע רק מעבדה במשרדים של מגן. מה שהתחיל בקורס של מספר שבועות הפך במהרה לשנתיים וחצי של שירות "צבאי" במעבדה של מגן, ונתן לי את האפשרות להצמד למומחים וללמוד מהם את רוב מה שאני יודע היום. בסיום השירות הצבאי, המעבר להיותי עובד מגן היה רק דבר טבעי.

במהלך שלוש השנים האחרונות יצא לי להיות שותף במספר פרוייקטים, חלקם גדולים יותר וחלקם גדולים פחות, ולהתמודד עם אתגרים מקצועיים ואישיים ביום יום. כמות החוויות שעברתי באדוונטק היא עצומה, וזאת ההזדמנות לומר כמה מילות תודה לאנשים שלוו אותי לאורך הדרך.

sg שמוליק גולדשטיין – האחד והיחיד. המנהל שלי בשנתיים האחרונות שבלעדיו לא הייתי כיום במקום שאני נמצא. שמוליק קיבל אותי אליו בתור מפתח, וגידל אותי להיות יועץ לתפארת – הציב בפני אתגרים, הקשה עלי בשאלות ושלח אותי ללקוחות הכי אסטרטגיים.
שמוליק הוא מנהל יחיד במינו. כזה שמבין מה מניע אותך כבר בהתחלה, ויודע למצוא את הדרך המקסימה להפעיל אותך, ללמד אותך ולהיות חבר שלך – כולם ביחד. לכבוד היה לי לעבוד איתו ואני בטוח שדברים שלמדתי ממנו ילוו אותי לעוד המון זמן. אני מאחל לכל אחד מנהל כמו שמוליק!

שמוליק – תודה!

orenk את אורן קנדל הכרתי עוד בתקופת הצבא, ומאז יצא לנו לעבוד יחד על מספר פרוייקטים כאשר בכל פעם אורן נמצא בפוזיציה שאני לומד ממנו. זה התחיל בכך שהוא לימד אותי .Net, אח"כ לימד אותי איך להשתמש בטכנולוגיה בצורה טובה, ולאחרונה – איך להיות שותף בארכיטקטורה מורכבת בארגון סבוך בפוליטיקה ארגונית. אז למרות שאורן מעולם לא היה ה"בוס" שלי, הוא תמיד היה המנחה שלי והציב לעצמו את ההתפתחות שלי כיעד.
את כמות הדברים שלמדתי מאורן במשך השנים קשה להכניס בפוסט אחד, אבל אפשר לסכם אותם בכך שקיבלתי ממנו את היכולת לראות את הדברים אחרת, ולחשוב מחוץ לקופסא. לא איחלתי לעצמי מורה דרך טוב כמוהו.

אורן – תודה!

כמו שאומר המשפט הידוע "כל סוף הוא התחלה חדשה" – אני עוזב את אדוונטק ומתחיל את הדבר הבא מבחינתי, אבל נשאר בסביבה (אפילו קרוב מאד...). בפוסט נוסף אכתוב לאן אני הולך ומה זה אומר מבחינתי. (או מבחינתכם...)

גיא

LINQ to SQL Concurrency - ChangeConflictException Row not found or changed

LINQ to SQL Concurrency - ChangeConflictException Row not found or changed

ChangeConflictException Row not found or changed If we create a small model of the Northwind database, and we try to modify one of the customers (lets take ALFKI for example):

NorthwindDataContext db = new NorthwindDataContext();

 

Customer alfki = db.Customers.Single(c => c.CustomerID == "ALFKI");

alfki.City = "London";

 

db.SubmitChanges();

We will see that the update command that is created by the run time is:

UPDATE   Customers

SET      City = 'London'

WHERE    CustomerID = 'ALFKI' AND

         CompanyName = 'Alfreds Futterkiste' AND

         City = 'Berlin' AND

         Region IS NULL

Of course, the update command updates the City column in the Customers table according to the appropriate CustomerID value, but what with all these other conditions in the where clause?

LINQ to SQL uses Optimistic Concurrency strategy. When it selects records, it does not perform any locking on the selected rows. Only when it tries to update records in the database or delete them, it checks that the records were not changed since the last time they were selected. How does it do it? It tries to update the row that matches the original values, as the DataContext got them when it selected the rows. This explains the additional conditions on the update command.

If during the time the logic was done, updates were made from another program (or another DataContext for that matter), an exception will be thrown:

System.Data.Linq.ChangeConflictException was unhandled
  Message="Row not found or changed."
  Source="System.Data.Linq" 

LINQ to SQL tried to look for the record to updated comparing all the columns to their original values, and when no records where found, the exception was thrown. This is the way LINQ to SQL tells us that the row it was looking for was deleted or changed by another program and the update cannot be done.

Enjoy!

לוח הזמנים של הרצאות הכנס עלה לאויר

אין ספק שיש המון הרצאות מעניינות ופאנלים שכדאי להגיע אליהם בכנס בשבוע הבא...

כדי שתוכלו לתכנן את סדר היום שלכם, לדעת לאיזו הרצאה או לאיזה פאנל תכנסו, ומאיפה לאיפה תרוצו בכל הפסקה, מומלץ להסתכל ברשימת ההרצאות המעודכנת ובלוח הזמנים.

Developer Academt 2 Sessions

לא לשכוח שביום האירוע תתקיים פינת בלוגרים בה תוכלו לפגוש את הבלוגרים החביבים עליכם, ולעשות Live Blogging תוך כדי הכנס!

תהנו!

Copy Source As Html (CopySourceAsHtml) for Visual Studio 2008 RTM

Copy Source As Html (CopySourceAsHtml) for Visual Studio 2008 RTM

 Copy Source As Html CopySourceAsHtml for Visual Studio 2008 RTM

After the release of Visual Studio 2008 RTM, I really needed to blogs about technical stuff and needed Copy Source As Html (CopySourceAsHtml) with Visual Studio 2008 support.

You can download this zip file, and extract it to your Visual Studio 2008 Addins folder. For vista is it C:\Users\<username>\Documents\Visual Studio 2008\Addins, and it should be somewhere under C:\Documents and settings If you're working with XP. Notice that this folder might not be exist, so you should create it.

Copy Source As Html CopySourceAsHtml for Visual Studio 2008 RTM

After placing the files in this directory, simply restart Visual Studio 2008, and you can start working with the addin.

To make things faster, I usually customizing a keyboard shourtcut for this addin. I go to Tools -> Options, and under Environment node I select the Keyboad node. I look for the CopySourceAsHtml.Connect.CopyNow command, and assign Ctrl+Shift+H for it.

Copy Source As Html CopySourceAsHtml for Visual Studio 2008 RTM

Disclaimer: Using the above addin is under the copyrights of J.T. Leigh & Associates Inc. Any use of this addin is not supported and on your own risk.

Copy Source As Html (CopySourceAsHtml) for Visual Studio 2008 RTM.

Enjoy!

LINQ to SQL: Table<T>.Detach Method Does Not Exist

LINQ to SQL: Table<T>.Detach Method Does Not Exist

LINQ to SQL Table<T>.Detach

Moving from Visual Studio 2008 Beta 2 to Visual Studio 2008 RTM, I read about LINQ to SQL Breaking Changes from Visual Studio 2008 Beta 2 to RTM.

From the document:

Table<T>.Attach changed to throw an exception if attached entity has not been detached

The designed purpose of Table<T>.Attach method is to let you make a DataContext aware of objects that are transferred from other tiers, usually through serialization/deserialization. Once the entities are attached, the DataContext can track their original state for update purposes as if they had been fetched initially by this DataContext. However, if you attempt to attach an entity from a second DataContext on the same machine without first calling .Detach on that entity, you may start to run into various issues, including deferred loaders that are still set up to load their objects from the original DataContext.

To help reduce this confusion in RTM, we’ve added a check in .Attach to ensure that the entity you’re attaching has been properly detached from its previous DataContext first if it has deferred loaders. We also more intelligently handle related entities linked to by the attached entity to ensure they do not get inserted into the table again if you later attach them as well.

Workaround

Be sure to call Table<T>.Detach on your entities on their original DataContext before trying to call Table<T>.Attach within their new DataContext.

For example, if you write the following code:

NorthwindDataContext db = new NorthwindDataContext();

Employee emp = db.Employees.First();

 

NorthwindDataContext db2 = new NorthwindDataContext();

db2.Employees.Attach(emp);

You'll get an exception: "An attempt has been made to Attach or Add an entity that is not new, perhaps having been loaded from another DataContext.  This is not supported."

Whilw trying to follow the above workaround from the document, I realized that Table<T>.Detach method does not exist at all! I even opened Reflector to see it clearly and it is true. Table<T>.Detach method does not exist at all!

Trying to find an answer to the question how can I detach entities that were attached to one DataContext in order to attach to another one, and found this answer in Dinesh Kulkarni's post:

"what do I call to detach an entity? The answer is nothing! If an entity is serialized and deserialized back, it is already detached from the DataContext instance used for retrieval "

Conclusion:

1. There is a bug in the Breaking Changes document. I hope it will be fixed ASAP.

2. You cannot detach the entities from previous DataContext's without serializing and deserializing the entities.

LINQ to SQL Breaking Changes from Visual Studio 2008 Beta 2 to RTM

LINQ to SQL Breaking Changes from Visual Studio 2008 Beta 2 to RTM

LINQ to SQL Breaking Changes Beta 2 to RTM

With the release of Visual Studio 2008, there are some changes moving LINQ to SQL projects from Visual Studio 2008 Beta 2 to Visual Studio 2008 RTM.

There was already writen by Dinesh Kulkarni, the PM of LINQ to SQL in this post, but now they are officially published in a complete document.

Download it here.

Enjoy!

C# 3.0, LINQ and LINQ to SQL Hands on Labs for Visual Studio 2008 RTM

C# 3.0, LINQ and LINQ to SQL Hands on Labs for Visual Studio 2008 RTM

C# 3.0, LINQ, LINQ to SQL Hands on Labs RTM

After the release of Visual Studio 2008 RTM, the Visual Studio 2008 Samples page on MSDN was update accordingly. You can find few Hands on Labs there that will help you practice the new language features:

  • C# 3.0 Language Enhancements Hands On Lab
  • LINQ Hands On Labs
  • LINQ to SQL Hands on Lab
  • Additionally, you can Download Visual Studio 2008 and .NET Framework 3.5 Training Kit for other new technologies around.

    Enjoy!

    Visual Studio 2008 RTM Live and Kicking!

    Visual Studio 2008 RTM Live and Kicking!

    Yesterday, after the announcement that Visual Studio 2008 RTM Is Available for MSDN Subscribers, I downloaded and installed it, following Scott Guthrie's Installation Suggestions. The installation ran over the night so I can't really tell how long it took, but as of this morning - Visual Studio 2008 RTM Live and Kicking!

     vs2008_splash

    Enjoy!

    Download Visual Studio 2008 and .NET Framework 3.5 Training Kit

    Download Visual Studio 2008 and .NET Framework 3.5 Training Kit

    Visual Studio 2008 and .NET Framework 3.5 Training Kit

    With the release of Visual Studio 2008 RTM earlier today, the Visual Studio 2008 and .NET Framework 3.5 Training Kit is also available for download. (120Mb of training materiel...)

    This kit contains Labs, Demos and PPTs about various technologies coming up with Visual Studio 2008 and .Net Framework 3.5. So If you're a little behind, this is your chance to catch up!

    Fundamentals: Framework and Language Enhancements

    • Lap around Visual Studio 2008 & .NET Framework 3.5
    • .NET Language Integrated Query (LINQ)
    • Using LINQ with Relational Data
    • What's new in C# 3.0?
    • What's new in Visual Basic 9.0?
    • .NET Framework 3.5 Enhancements
    • ADO Synchornization Services

    Building Rich Client Experiences

    • Introduction to the Microsoft Client Continuum
    • Introduction to ASP.NET AJAX
    • Building Web Applications with Visual Studio 2008
    • Introduction to Silverlight
    • What's New in Windows Presentation Foundation 3.5
    • Building Windows Presentation Foundation Applications in Visual Studio 2008 and Expression Blend

    Building Connected Applications

    • Connected Application Foundations using WCF, WF, and Windows CardSpace
    • Web Programming with WCF
    • Building Microsoft Windows Workflow Foundation Enabled Windows Communication Foundation Services in .NET Framework 3.5
    • Integrating Windows CardSpace

    Building Applications for Microsoft Office and Windows Mobile

    • Overview of Office Business Applications and VSTO
    • Extending the Office Fluent UI using VSTO
    • Building SharePoint Workflows
    • Building Mobile Applications using Visual Studio 2008 and the .NET Compact Framework 3.5

    Application Lifecycle Management

    • Introducing Application Lifecycle Management
    • Value-up software development
    • The Business Analyst Perspective
    • The Project Managers Perspective
    • The Architect Perspective
    • The Developers Perspective
    • The Testers Perspective

     With this training kit, the teams also posted some sessions on channel 9:

    Enjoy!

    Visual Studio 2008 RTM Is Available for MSDN Subscribers

    Visual Studio 2008 RTM Is Available for MSDN Subscribers

    Visual Studio 2008 RTM

    The well anticipated release of Visual Studio 2008 RTM is finally available for download for MSDN Subscribers.

    If you're an MSDN Subscriber, go to http://msdn2.microsoft.com/subscriptions and start download Visual Studio 2008 RTM.

    Visual Studio 2008 RTM

    Enjoy!

    פרטים נוספים לגבי Developer Academy 2

    פרטים נוספים לגבי Developer Academy 2

    Developer Academy 2 תודה לכל האנשים שנרשמו לכנס! ביום חמישי בלילה נפתחה ההרשמה ל- Developer Academy 2, ותוך 4 ימים נרשמו מעל 1000 איש!

    כמה דברים שכדאי לדעת:

    הכנס לא בתשלום, אבל נדרשת הרשמה מוקדמת, אותה תוכלו לעשות כאן. השנה יקפידו במיוחד על נושא ההרשמות לאור כמות האנשים שלא נרשמו בשנה שעברה שהביאה ללחץ אדיר באולמות. אם עדיין לא נרשמתם, או שאתם מכירים מישהו שעדיין לא נרשם - מהרו!

    בכנס יהיו 25 הרצאות, בכל רגע נתון יהיו 5 הרצאות במקביל מה שאומר שמאד חשוב שתעברו על רשימת ההרצאות של הכנס ותבחרו מראש לאילו הרצאות אתם מעוניינים ללכת, לפי המטריצה הזאת. בנוסף, יהיו בכנס מספר פאנלים של מומחים בתחומים שונים (פוסטים על זה בהמשך...). אם יש לכם שאלות בנושאים כלשהם - יש לכם הזדמנות לשאול את המומחים בתחום!

    איך להגיע? מפת הגעהתוכלו למצוא כאן, אבל למי שלא מסתדר איתה (כמוני, עד ממש לאחרונה) ההוראות הכי פשוטות הן: לנסוע על כביש מספר 1 ולרדת במחלף לוד. לא מחלף בן גוריון, אלא מחלף לוד. במחלף לנסוע לכיוון פתח תקווה וברמזור הראשון ימינה לכביש 46. משם כבר תראו את הבניין שכתוב עליו Avenue ואתם שם. קחו בחשבון שיש תנועה בשעות הבוקר, אז כדאי לקחת מספיק זמן ביטחון לפקקים.

    אוכל - יש אוכל לכולם! ויש הרבה! מהרבה סוגים והרבה סגנונות! אז קחו את הזמן בין כל הרצאה להרצאה להינות מהכיבוד, כדי שלא תהיו לחוצים לקראת ארוחת צהרים. באופן אישי ההרצאה שלי נופלת לפני הארוחה הגדולה ומאד הייתי עצוב לראות אנשים נוטשים כמה דקות לפני סוף ההרצאה כדי להספיק לאוכל... אז שוב - יש מספיק אוכל לכולם, אין צורך להסתער...

    פינת בלוגרים - בכנס תהיה פינת בלוגרים בה תוכלו לפגוש את הבלוגרים החביבים עליכם במיוחד. אם אתם קוראים בלוג ומעולם לא פגשתם באופן אישי את מי שכותב אותו, זאת ההזדמנות לעשות את זה. אני יודע שאני אשמח להכיר לראשונה כמה מהקוראים שלי :)

    בלוגרים - מוזמנים לכתוב על האירוע כבר מעכשיו וכמובן לסקר את האירוע ולעשות Live Blogging תוך כדי. רחשוב להקפיד לשים תגית בשם DevAcademy2 (בדיוק בכתיב הזה), כדי שכולם יוכלו להכנס לדף הפוסטים בנושא Developer Academy 2. ניתן להרשם ל- RSS Feed של Developer Academy 2. בעתיד יהיה גם קישור לדף ה- Technorati על התגיות הזאת. בלוגרים שכתבו כבר פוסטים על הכנס, יכולים עדיין להוסיף את התגית לפוסטים הקיימים על מנת להופיע ברשימת הפוסטים.

    עוד משהו שפספסתי בנוגע ל- Developer Academy 2 ושווה התייחסות?

    ההרשמה ל- Developer Academy 2 נפתחה

    ההרשמה ל- Developer Academy 2 נפתחה

    Developer Academy 2 זו השנה השנייה לאירוע Developer Academy וכבשנה שעברה מדובר ביום עשיר בתכנים, טכנולוגיה חדשה והמרצים הטובים ביותר (אני גאה להיות אחד מהם..). האירוע השנה מתמקד בהרצאות שיעזרו לכם ללמוד ולהתכונן ליציאת גרסאות המוצרים החדשות – Visual Studio 2008, SQL Server 2008 ו- Windows Server 2008.

    ישנן 25 הרצאות ב-5 מסלולים, ובנוסף, לאורך היום יתקיימו פאנלים עם מומחים שנועדו לאפשר לכם קשר ישיר עם המרצים והיועצים בכנס, לשאול כל שאלה ולקבל תשובות ישירות ומקצועיות על בסיס מומחיות מקצועית וניסיון עשיר אצל לקוחות.
    כל ההרצאות יוקלטו ויעלו לאתר לאחר האירוע כך שלא תפסידו כלום! ניתן לחזור ולצפות בהרצאות בזמן המתאים לכם.

    הכנס יתקיים במרכז הכנסים והאירועים Avenue ב-Airport City (מפת הגעה: http://www.avenue-l.co.il/map.pdf)

    אפשר להרשם כאן. (ישנה טעות בכותרת האירוע, לא להבהל...)

    למי שיש יוזר ב- Facebook, ניתן גם למצוא את האירוע כאן (ההרשמה כאן לא רשמית, כמובן :))

    נתראה שם!

    Just Released: Service Factory Modeling Edition (v3) for Visual Studio 2005

    Just Released: Service Factory Modeling Edition (v3) for Visual Studio 2005

    Service Factory Modeling Edition Visual Studio 2005 As I've written in my post Web Service Software Factory Modeling Edition Roadmap, the final release of Service Factory: Modeling Edition (v3) supports Visual Studio 2005 only. The Visual Studio 2008 release should be out around February, the same time that Visual Studio 2008 is launched.

    You can download the Service Factory Modeling Edition (v3) for Visual Studio 2005 release from codeplex.

    Watch the 15 minutes Walktrough

    This walkthrough provides a very brief introduction to people who either do not have a lot of time for an introduction, or those who are looking for a presentation demo.

    Download the Hands-On-Labs

    This hands-on lab provides eight exercises to briefly introduce most of the experiences of building a Web service using the Service Factory. This includes modeling the services, data contracts, and host options, creating the project structure, and generating the code for both WCF and ASMX implementations. It also shows how to translates from business entities to messages as well as expose and consume the service.

    Watch the videos

    • Don demonstrates how to create model elements by importing an existing WSDL document. Watch it now (Length: 5:50 - Size: 6.18 MB)
    • Don shows off the new project mapping capability for code generation. Watch it now (Length: 7:10 - Size: 11.12 MB)
    • Don shows off the very first community release of Service Factory v3. Watch and download it now (Length: 12:41 - Size: 11.4 MB)
    • Don introduces the WCF Service Factory. Interested in re-delivering this presentation? Watch and download it now
    • Don creates some service interfaces with the WCF Service Factory. Interested in performing this demo yourself? Watch and download it now
    • Don introduces a number of ways we think about Web services. Do you agree? Watch it now (Length: 6:01 - Size: 1.97 MB)
    • Don and Dragos walk through the Web service domain model the team is working with. Watch it now (Length: 05:14 - Size: 1.41 MB)

    If you have any questions about Service Factory Modeling Edition (v3) for Visual Studio 2005, refer to the discussions forum, also on codeplex.

    Enjoy!

    Frequently Asked Questions and Answers about ADO.Net Entity Framework

    Frequently Asked Questions and Answers about ADO.Net Entity Framework

    The ADO.Net Entity Framework team has posted the first draft of Entity Framework FAQ. This is a collection of frequently asked questions and answers about ADO.Net Entity Framework, taken from the related MSDN Forum and customers feedback. This is valuable resource for everyone who adapts ADO.Net Entity Framework these days.

    Topics you can find there:

    • Resources for learning about ADO.Net Entity Framework
    • Architecture / Patterns
    • POCO Support
    • Code Generation
    • Databinding
    • etc.

    Note that this is the first draft, so things may be more descriptive than they will be when this document is done. Additionally, you may offer questions and answers you think that should be there.

    Enjoy!

    More Posts Next page »