如何在c#,asp.net中创建可重用的用户模块,可以在其他应用程序中轻松使用。 [英] How to create a reusable user module in c#, asp.net which can be easily used in other applications.

查看:63
本文介绍了如何在c#,asp.net中创建可重用的用户模块,可以在其他应用程序中轻松使用。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在c#,asp.net中创建一个可重用的用户模块,它可以很容易地在其他应用程序中使用。我已经为用户模块创建了一个可以重用的类库。它包含插入,更新,删除和查看用户。我已经在这个类库中编写了这些操作的代码。我在其他应用程序中使用它。它工作正常。但是,除了我的类库或dll之外,如果我需要在我的新应用程序中为用户提供一些额外的实体,我该怎么办?请给我一些解决方案。



谢谢。

解决方案

如果你想扩展它使用一些其他属性,然后从类继承并在子类中添加addtional属性。此外,应该将基类成员的访问修饰符设置为公共。



或者您可以使用已有的类库类的扩展方法来扩展它功能。



参考



C#中的扩展方法 [ ^ ]



extension-methods-in-C-Sharp-3-0 / [ ^ ]



http://msdn.microsoft.com/en-us//library /bb383977.aspx [ ^

I have to create a reusable user module in c#, asp.net which can be easily used in other applications. I have created a class library for user module that can be reusable .It contains Insert, update, delete and view users .I had written code for these operations in this class library. And I am using it in other application .It works fine. But what should I have to do if I need some extra entities for user in my new application other than my class library or dll . Please suggest me some solution to it.

Thanks.

解决方案

if you want to Just Extend it with some Additional Properties , then inherit from the Class and add the addtional properties in the Child Class. Also , should make set the Access Modifiers of the Base Class Members to Public.

Or You can use Extension Methods for the already existing Class Library Classes for extending it with Additional Functionalities.

Refer

Extension Methods in C# [^]

extension-methods-in-C-Sharp-3-0/[^]

http://msdn.microsoft.com/en-us//library/bb383977.aspx[^]


这篇关于如何在c#,asp.net中创建可重用的用户模块,可以在其他应用程序中轻松使用。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆