开发者

.NET and DLL's in several projects

My current issue is I have a DLL which has a cl开发者_C百科ass I use as an abstraction for my Database Mappers. I use this DLL in all my projects (including other class libraries/dlls) that access the database. My issue is that every time I update my Data Mapper dll I have to updating it in all the other dll's I am using in my main project as well (right now this means 3 other class libraries). When I am trying to debug the dll library on my main project this becomes a lot of work for each small change. Is there a better way to approach this?

Thanks.


If I've understood the question properly, here are two possibilities:

  • Reference the project source rather than the assembly in your various projects.
  • Create a post build task that copies your shared assembly dll to a central location that your other projects can access it from. Something like:

    copy "$(TargetPath)" $(SolutionDir)SharedAssemblies\$(TargetFileName)


From the wording of your question it seems that you're linking into a mapper like LINQ and using the classes that it generates are your model classes, thus resulting in changes all over when you recompile.

If this is the case: You might want to consider creating your own models and mapping them to the data mapper classes generated. Look at something like the Repository Pattern. Then you basically create a layer above your data mapper, and your application uses that layer.

If this is not the case:

  • Don't reference the dll, reference the project.
  • Compile all your assemblies into one, or you can use something like ILMerge to make one assembly as well.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜