在不同项目之间共享 Web 用户控制
有没有办法在不同项目之间共享用户控件?
我创建了用户控件,如登录控件、菜单控件、标题控件、丢失密码控件等,它们都连接到 SQL 数据库以获取数据。
我想在不同的网站项目之间共享这些,这意味着我具有相同的功能,并且我唯一可以做的修改是在 CSS 样式内。
我是否需要复制模块,或者有没有办法将它们保留为共享类/模块并在每次需要时调用我需要的内容?
谢谢。
Is there a way to share user controls between various projects ?
I have created user controls like login control, menu control, header control, lost password control and etc and they are all connected to sql database for data.
I would like to share these between various web site projects, it means I have same functionality and the only modifications I can do is within CSS styles.
Do I need to copy modules or is there a way to keep them as shared classes/modules and call what I need every time I need it?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以创建一个程序集/库作为一个额外的项目,将所有用户控件放入其中。然后在不同的项目中引用该库。
但我建议您使这些控件更加通用,以便您不依赖于特定的数据库连接或任何业务逻辑。
您可能也会对本文感兴趣:
You could just make an assembly/library as an extra project where you put all your user controls in. You reference this library then in different projects.
But I suggest you to make these controls then more generic, so that you do not depend on a certain database connection or any business logic.
This article might also be interesting for you: