locked
CUSTOM InstanceProvider WCF RRS feed

  • שאלה

  • שלום

    לא ברור לי למה כאשר אני יוצרCUSTOM InstanceProvider

    אני צריך להוסיף אותו ל כל END POINT של ה SERVICE

    למה לא עושים את זה ברמת ה SERVICE

    האם זה בגלל שניתן להגדיר מאפייני יצירה ו CONCURRENCY וכולי ברמת INTERFACE,כל אחד שונה מהשני?

    תודה

    יום ראשון 08 אפריל 2012 19:20

תשובות

  • זה לא עניין של תסריט כזה או אחר, זה עניין של מתי אתה יודע את כל המידע הנדרש להחלטה על יצירת instance.

    אם תסתכל על המבנה של instance provider תוכל לשים לב שהוא מקבל instance context - ה-context מגדיר בעצם את מצב העבודה שלנו (session, percall, single) ולפיו אנחנו יודעים איך לייצר את ה-instance. הבעיה היא ש-context לא נגזר אך ורק מהגדרות ה-ServiceBehavior אלא גם מהגדרות ה-channel (תלוי binding) ומהגדרות ה-contract (תלוי הגדרת SessionMode ב-contract).

    מאחר וה-instance context תלוי בכמה גורמים, לא ניתן לדעת מה הוא ברמת ה-service, אלא רק ברמת ה-endpoint, ולכן ההצמדה של instance provider מבוצעת ברמת ה-dispatcher ולא ברמת ה-service.

    מקווה שזה עוזר להבין.


    Please mark posts as answers/helpful if it answers your question.
    Senior Consultant on WCF, ASP.NET, Siverlight, and Entity Framework. Author of Microsoft's Official WCF 4 Course. Co-author of the Microsoft HPC/Azure burst whitepaper.
    Visit my blog: http://blogs.microsoft.co.il/blogs/idof

    • סומן כתשובה על-ידי NoundaDee יום רביעי 11 אפריל 2012 07:00
    יום שלישי 10 אפריל 2012 08:40
    מנחה דיון

כל התגובות

  • כפי שציינת, instance provider צריך לקחת בחשבון דברים כמו הגדרות session, שאינם זמינים ברמת ה-service, אלא רק ברמת ה-endpoint dispatcher. לכן החיבור של instance provider הוא לקונטקסט של endpoint ולא של service.

    ניתן לקרוא עוד על instance provider ואופן העבודה איתו בפוסט הבא:

    http://blogs.msdn.com/b/carlosfigueira/archive/2011/05/31/wcf-extensibility-iinstanceprovider.aspx


    Please mark posts as answers/helpful if it answers your question.
    Senior Consultant on WCF, ASP.NET, Siverlight, and Entity Framework. Author of Microsoft's Official WCF 4 Course. Co-author of the Microsoft HPC/Azure burst whitepaper.
    Visit my blog: http://blogs.microsoft.co.il/blogs/idof

    • הוצע כתשובה על-ידי tetitu יום שני 09 אפריל 2012 08:44
    יום שני 09 אפריל 2012 08:39
    מנחה דיון
  • :) בדיוק בגלל הדוגמא הזאת שאלתי...

    אתה יכול לתאר תסריט בו ב ENDPOINT אחד נדרש SESSION ו ב ENDPOINT אחר לא?

    תודה.

    יום שני 09 אפריל 2012 15:33
  • זה לא עניין של תסריט כזה או אחר, זה עניין של מתי אתה יודע את כל המידע הנדרש להחלטה על יצירת instance.

    אם תסתכל על המבנה של instance provider תוכל לשים לב שהוא מקבל instance context - ה-context מגדיר בעצם את מצב העבודה שלנו (session, percall, single) ולפיו אנחנו יודעים איך לייצר את ה-instance. הבעיה היא ש-context לא נגזר אך ורק מהגדרות ה-ServiceBehavior אלא גם מהגדרות ה-channel (תלוי binding) ומהגדרות ה-contract (תלוי הגדרת SessionMode ב-contract).

    מאחר וה-instance context תלוי בכמה גורמים, לא ניתן לדעת מה הוא ברמת ה-service, אלא רק ברמת ה-endpoint, ולכן ההצמדה של instance provider מבוצעת ברמת ה-dispatcher ולא ברמת ה-service.

    מקווה שזה עוזר להבין.


    Please mark posts as answers/helpful if it answers your question.
    Senior Consultant on WCF, ASP.NET, Siverlight, and Entity Framework. Author of Microsoft's Official WCF 4 Course. Co-author of the Microsoft HPC/Azure burst whitepaper.
    Visit my blog: http://blogs.microsoft.co.il/blogs/idof

    • סומן כתשובה על-ידי NoundaDee יום רביעי 11 אפריל 2012 07:00
    יום שלישי 10 אפריל 2012 08:40
    מנחה דיון
  • אגב, יש לי מצגת שעשיתי בסדנת advanced WCF - בסוף שלה יש כמה שקפים וגם דוגמת קוד של custom behaviors.

    http://lanyrd.com/2012/selasdp/spqyq


    Please mark posts as answers/helpful if it answers your question.
    Senior Consultant on WCF, ASP.NET, Siverlight, and Entity Framework. Author of Microsoft's Official WCF 4 Course. Co-author of the Microsoft HPC/Azure burst whitepaper.
    Visit my blog: http://blogs.microsoft.co.il/blogs/idof

    יום שלישי 10 אפריל 2012 08:46
    מנחה דיון
  • אחלה תודה רבה,זה אותו קורס שיניב העביר?

    יום רביעי 11 אפריל 2012 07:16
  • אם הכוונה ליניב רודנסקי, אז לדעתי זה קורס אחר, כי לא זכור לי שיניב העביר עד כה את הסדנה הזו.


    Please mark posts as answers/helpful if it answers your question.
    Senior Consultant on WCF, ASP.NET, Siverlight, and Entity Framework. Author of Microsoft's Official WCF 4 Course. Co-author of the Microsoft HPC/Azure burst whitepaper.
    Visit my blog: http://blogs.microsoft.co.il/blogs/idof

    יום רביעי 11 אפריל 2012 07:34
    מנחה דיון