<div dir="ltr">To reach the Entity Framework developers, I'd suggest posting to their discussion forums: <a href="http://entityframework.codeplex.com/discussions">http://entityframework.codeplex.com/discussions</a></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 28, 2013 at 9:30 PM, mlgo <span dir="ltr"><<a href="mailto:mlintner@sinenomine.net" target="_blank">mlintner@sinenomine.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div style="direction:ltr;font-size:10pt;font-family:Tahoma">
<p>  </p>
<p>Thanks, I had seen that link already. How would I find Entity Framework developers?</p>
<p> </p>
<p>          It looks like EF is using it to while iterating through the cache to select the assembly which matches the assemblyname being passed in. The function it is used in is</p>
<pre style="background:white;font-size:13px;font-family:Consolas"><pre style="background:white;font-size:13px;font-family:Consolas"><span style="COLOR:#2b91af">DefaultAssemblyResolver</span>.ResolveAssembly and they use it as follows:
</pre><pre style="background:white;font-size:13px;font-family:Consolas"> </pre></pre>
<pre style="background:white;font-size:13px;font-family:Consolas">            <span style="COLOR:green">// look in the already loaded assemblies</span>
            <span style="COLOR:blue">foreach</span> (<span style="COLOR:blue">var</span> current <span style="COLOR:blue">in</span> GetAlreadyLoadedNonSystemAssemblies())
            {
                <span style="COLOR:blue">if</span> (<span style="COLOR:#2b91af">AssemblyName</span>.ReferenceMatchesDefinition(referenceName, <span style="COLOR:blue">new</span> <span style="COLOR:#2b91af">AssemblyName</span>(current.FullName)))
                {
                    <span style="COLOR:blue">return</span> current;
                }
            }
 
</pre>
<p>I had been looking at that link but it contradicts even the MSDN description. It seems obvious that without logic to take version into account the version it cannot resolve a correct from incorrect dll.</p>
<p> </p>
<div><span style="font-size:13px;font-family:'Segoe UI','Segoe UI Web Regular','Helvetica Neue',Tahoma,Verdana,Arial"><a href="http://stackoverflow.com/questions/2494421/how-does-assemblyname-referencematchesdefinition-work" rel="nofollow" link="external" target="_blank">http://stackoverflow.com/questions/2494421/how-does-assemblyname-referencematchesdefinition-work</a></span></div>

<div> </div>
<div>I was digging around on that link Somewhere on that page there is a response by some other Microsoft developers, which give an explanation of the compare which at least would be able to tell one dll from another in a meaning full way which lead me to change
 the implementation to the following:<br>
</div>
<p></p><div class="im">public static bool ReferenceMatchesDefinition (AssemblyName reference,<br>
 AssemblyName definition)<br>
                 {<br>
                         if (reference == null)<br>
                                 throw new ArgumentNullException ("reference");<br>
                                 <br>
                         if (definition == null)<br>
                                 throw new ArgumentNullException ("definition");<br>
                         <br></div>
                        if (!reference.Name.Equals(definition.Name, StringComparison.InvariantCultureIgnoreCase))<br>
                        {<br>
                          return false;<br>
                        }<br>
                        <br>
                        // <a href="http://stackoverflow.com/questions/2494421/how-does-assemblyname-referencematchesdefinition-work" rel="nofollow" link="external" target="_blank">
http://stackoverflow.com/questions/2494421/how-does-assemblyname-referencematchesdefinition-work</a><br>
                        // "A ReferenceIdentity matches a DefinitionIdentity, if and only if the value of all the attributes
<br>
                        // specified in the ReferenceIdentity match the value of the corresponding attributes of the DefinitionIdentity.<br>
                        // If an attribute is missing in the ReferenceIdentity, it matches any value for that attribute in DefinitionIdentity.
<br>
                        // For example, Ref “name” matches Def “name, culture=neutral”, and Def “name, culture=en-us”.
<br>
                        // But Ref “name, culture=neutral” does not match Def “name, culture=en-us”."
<br>
                        if (reference.CultureInfo != null)<br>
                        {<br>
                          if (definition.CultureInfo == null || reference.CultureInfo != definition.CultureInfo )<br>
                          {<br>
                           return false; <br>
                          }<br>
                        }.<br>
   <br>
  <br>
       byte [] refToken = reference.GetPublicKeyToken(); <br>
       if (refToken != null && refToken.Length != 0)<br>
       {<br>
                 byte [] defToken = definition.GetPublicKeyToken(); <br>
                     if (deftoken == null || defToken.Length != 4 || <br>
                     refToken[0] != defToken[0] || refToken[1] != defToken[1]  ||
<br>
                     refToken[2] != defToken[2]  || refToken[3] != defToken[3]  )<br>
                          {<br>
                           return false; <br>
                          } <br>
                          <br>
                            if (reference.Version != null)<br>
                             {<br>
                           if (definition.Version == null || reference.Version != definition.Version )<br>
                            {<br>
                             return false; <br>
                            }        <br>
                         }<br>
         <br>
                       }<p></p>
<p>                        return true ;<br>
                 }<br>
</p>
<p>Don't know how Im going to find entity Framework developers. I always will write Unit Tests of course.</p>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="DIRECTION:ltr"><font color="#000000" face="Tahoma"><b>From:</b> Marek Safar-2 [via Mono] [ml-node+<a href="http://user/SendEmail.jtp?type=node&node=4660697&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>]<br>

<b>Sent:</b> Wednesday, August 28, 2013 2:21 AM<div class="im"><br>
<b>To:</b> Mark Lintner<br>
<b>Subject:</b> Re: A possible implementation for AssemblyName.ReferenceMatchesDefinition<br>
</div></font><br>
</div>
<div></div>
<div><div class="im">
<div dir="ltr">Hi,
<div><br>
</div>
<div>This API is broken by design and it's not clear what it should really do. It'd probably be better to check with EF devs whether they really intended to use it and for what purposes. Even for naive implementation please write unit test and check whether
 it passes on .net</div>
<div><br>
</div>
<div><span style="font-size:13px;font-family:'Segoe UI','Segoe UI Web Regular','Helvetica Neue',Tahoma,Verdana,Arial"><a href="http://stackoverflow.com/questions/2494421/how-does-assemblyname-referencematchesdefinition-work" rel="nofollow" link="external" target="_blank">http://stackoverflow.com/questions/2494421/how-does-assemblyname-referencematchesdefinition-work</a></span></div>

<div><br>
</div>
<div>Marek</div>
<div><br>
</div>
</div>
</div><div class="gmail_extra"><br>
<br>
<div class="gmail_quote"><div class="im">On Tue, Aug 27, 2013 at 5:29 PM, mlgo <span dir="ltr"><<a href="https://connect.emailsrvr.com/owa/UrlBlockedError.aspx" rel="nofollow" link="external" target="_blank">[hidden email]</a>></span> wrote:<br>

</div><blockquote style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><div class="im">
According to<br>
<a href="http://msdn.microsoft.com/en-us/library/system.reflection.assemblyname.referencematchesdefinition.aspx" rel="nofollow" link="external" target="_blank">http://msdn.microsoft.com/en-us/library/system.reflection.assemblyname.referencematchesdefinition.aspx</a><br>

<br>
The following is what is expected to be returned from<br>
ReferenceMatchesDefinition.<br>
<br>
Returns a value indicating whether two assembly names are the same. The<br>
comparison is based on the simple assembly names.<br>
<br>
This seems naïve but below is a tentative implementation of that. Any ideas?<br>
<br>
public static bool ReferenceMatchesDefinition (AssemblyName reference,<br>
AssemblyName definition)<br>
                {<br>
                        if (reference == null)<br>
                                throw new ArgumentNullException ("reference");<br>
                        if (definition == null)<br>
                                throw new ArgumentNullException ("definition");<br>
                        if (reference.Name != definition.Name)<br>
                                return false;<br>
<br>
                        return reference.Name.Equals(definition.Name);<br>
                }<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://mono.1490590.n4.nabble.com/A-possible-implementation-for-AssemblyName-ReferenceMatchesDefinition-tp4660683.html" rel="nofollow" link="external" target="_blank">
http://mono.1490590.n4.nabble.com/A-possible-implementation-for-AssemblyName-ReferenceMatchesDefinition-tp4660683.html</a><br>
Sent from the Mono - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Mono-devel-list mailing list<br>
</div><a href="https://connect.emailsrvr.com/owa/UrlBlockedError.aspx" rel="nofollow" link="external" target="_blank">[hidden email]</a><br>
<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" rel="nofollow" link="external" target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br>
</blockquote>
</div>
<br>
</div><div class="im">
<br>
_______________________________________________ <br>
Mono-devel-list mailing list <br>
<a href="https://connect.emailsrvr.com/owa/UrlBlockedError.aspx" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br>
<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" rel="nofollow" link="external" target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br>
<br>
<br>
<hr color="#cccccc" size="1" noshade>
</div><div style="COLOR:#444;FONT:12px tahoma,geneva,helvetica,arial,sans-serif"><div class="im">
<div style="FONT-WEIGHT:bold">If you reply to this email, your message will be added to the discussion below:</div>
</div><a href="http://mono.1490590.n4.nabble.com/A-possible-implementation-for-AssemblyName-ReferenceMatchesDefinition-tp4660683p4660696.html" rel="nofollow" link="external" target="_blank">http://mono.1490590.n4.nabble.com/A-possible-implementation-for-AssemblyName-ReferenceMatchesDefinition-tp4660683p4660696.html</a>
</div><div class="im">
<div style="COLOR:#666;FONT:11px/1.5em tahoma,geneva,helvetica,arial,sans-serif;MARGIN-TOP:0.4em">
To unsubscribe from A possible implementation for AssemblyName.ReferenceMatchesDefinition,
<a rel="nofollow" link="external">
click here</a>.<br>
<a style="FONT:9px serif" href="http://mono.1490590.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" link="external" target="_blank">NAML</a>
</div>
</div></div>
</div>
</div><div class="im HOEnZb">




        
        
        
<br><hr align="left" width="300">
View this message in context: <a href="http://mono.1490590.n4.nabble.com/A-possible-implementation-for-AssemblyName-ReferenceMatchesDefinition-tp4660683p4660697.html" target="_blank">RE: A possible implementation for AssemblyName.ReferenceMatchesDefinition</a><br>
</div><div class="HOEnZb"><div class="h5">
Sent from the <a href="http://mono.1490590.n4.nabble.com/Mono-Dev-f1517221.html" target="_blank">Mono - Dev mailing list archive</a> at Nabble.com.<br></div></div><br>_______________________________________________<br>
Mono-devel-list mailing list<br>
<a href="mailto:Mono-devel-list@lists.ximian.com">Mono-devel-list@lists.ximian.com</a><br>
<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br>
<br></blockquote></div><br></div>