Browse by Tags
All Tags »
tips and tricks (
RSS)
In the past, when we tried to connect from Silverlight 2 to WCF Services that threw exceptions (every now and then), we got the famous “Not found” Communication Exception. The reason we didn’t get a SOAP Fault is that WCF returns SOAP Fault responses with a HTTP code of 500 – this is according to SOAP protocol , but the browser doesn’t allow 500 responses to be returned to Silverlight – it replaces them with a CommunicationException and thus hides the real fault that returned. When we moved to Silverlight...
Last week, a colleague of mine asked me to create a sample composite design pattern model in Entity Framework. I thought to myself, no problem, created the table that contains the Component, Leaf & Composite entities (according to TPH – Table Per Hierarchy) and went to build the EDM based on the table and there I started to have problems which needed manual fixing. Since I’m working with EF 3.5, I’ve built the DB prior to the model – In EF 4.0 you can do model-first and build your db by script...
A few day ago, a colleague of mine, Shlomo Goldberg , raised a question about Entity Framework and large models. Another colleague of mine, Gil Fink posted some links to helpful tips for using large models, and I want to talk about one of these tips – using the View Generation option. If you’ve worked with large models in Entity Framework 3.5, you probably noticed that as the model grows, it takes more time to initialize the ObjectContext for the first time. A solution to this is to use view generation...
A few weeks ago I've published a post regarding DataDirect's new Oracle provider that supports EF. I was able to download DataDirect’s provider only this week, so it will take me a few more days to examine it and post some notes. As for now, I would like to share with you some of the issues in EF we’ve came across migrating from Sql Server to Oracle, using the provider from DevArt . BTW, we haven’t fully migrated to Oracle just yet, our project supports working with both databases using a...
Entity Framework supports entity inheritance, which is a basic requirement for O/R mappers. When exposing a model through a service, either an ASMX WS or a WCF service, a WSDL will be created that among other things describes the structure of the entities, including the inheritance tree of the entities - This is done to allow creation of methods that return polymorphic types. EF supports derived entities through WCF services with data contract serialization using the KnownTypeAttribute which is added...
When you build a EF schema, it automatically plant the name of the imported tables schema into the EDMX file. But alas, what happens when you work in different environments (such as Dev, Test, Prod...) and in each database, the schema of the tables is different? Basically you either reset all your databases to use the same schema or worse - change the EDMX and recompile the assembly before updating the wanted environment. But there is another solution, not a clear one, probably not a supported one...
I've received a couple of request to write some of my previous posts in English so that all other 99.7% of the developers community in the world which finds these subjects interesting can understand what I'm writing. The following post is a translation to English of this Hebrew post . When Entity Framework (EF for short) was designed, Microsoft decided the loading of entities will be during run-time in a JIT like mechanism. They achieved this by using the lazy loading technique - access the...
להלן בעיה - בהנתן Property כלשהו, נניח ששמו FirstName, עליכם להעביר למתודה את שם ה-Property כמחרוזת, תחת המגבלות הבאות: אינכם יכולים לרשום במפורש את שם ה-Property כמחרוזת ("FirstName") אינכם יכולים להשתמש ב-GetProperties, איכשהו לאתר את ה-PropertyInfo ולחלץ את שמו ממאפיין Name (לדוגמה - איתור ה-PropertyInfo הראשון שמתחיל ב-F ואורך שמו הוא 9) לפני כשנתיים נתקלתי בבעיה זו, כאשר וחיפשתי דרך לפתור את הבעיה שהוצגה בפוסט הקודם - העברה של שמות מאפיינים למתודה וקבלת ערכיהם (אז לא עלה בדעתי להשתמש...
ברצוננו לכתוב מתודה אשר תקבל שם קובץ חדש ורשימת קבצים בתיקייה ותחזיר שם קובץ תקין שאינו קיים בתיקייה (כמו שיצירת קובץ חדש בתיקייה תחת וינדוס יוצרת קבצים בשם "new", "new1", "new2" וכו'). string GetUniqueFileName(List<File> files, string newFileName) נוכל לכתוב מתודה אשר עוברת על רשימת הקבצים בתיקייה (List כלשהו) ומחפשת עפ"י מאפיין שם קובץ (obj.FileName) אם השם תפוס ואם כן, להוסיף לשם שהועבר איזשהו Suffix ולנסות שוב עד למציאת שם תקין. עכשיו בואו נסבך - נניח...
לפני שבועיים סשה פרסם פוסט על שיתוף קבצי Contract בין Service ל-Client שלו. הקונספט הזה העלה לי זכרונות ישנים לגבי פעולה זו וכדאי לשים לב לכמה דברים : 1. שיטה זו של קישור ע"י Link עובדת כל עוד היחס בין המסלולים (Path) נשמר בכל מחשבי הפיתוח - ברוב המקרים זה כך, אך יש לשים לב לכך בשביל שלא יווצרו broken links. 2. פתרון אפשרי אחר, למי שעדין עובד עם ה-VSS הישן של MS הוא לבצע Share של קובץ הקוד בין תיקיות הפרויקטים השונות ובכך לייצר עותק מקושר המנוהל ברמת ה-Source Control ולא ב-Studio. כך אפשר להתגבר...