我怎样才能制作一个框架来快速构建相似但不同的站点呢?

时间:2023-02-08 08:35:28

I have the need to build lots of sites that are very similar, but not exactly the same, using ASP.NET 2.0.

我有必要构建许多非常相似的站点,但使用ASP的站点并不完全相同。NET 2.0。

I'm trying to find the best way to make generating these sites quick and easy.

我正在努力寻找使这些网站快速而容易生成的最佳方法。

The sites will be used to collect information about a user, and there will be multiple steps for each site.

这些站点将用于收集关于用户的信息,每个站点将有多个步骤。

The sites will all collect similar information, but some sites may require less or more information than others. Additionally, certain form fields will need to be populated from different database tables, based on the site.

这些网站都会收集类似的信息,但有些网站可能比其他网站需要更少或更多的信息。此外,需要根据站点从不同的数据库表中填充某些表单字段。

I would like to use a Microsoft patterns & practices solution, but I'm not sure that there is one that fits this scenario.

我想使用Microsoft模式和实践解决方案,但我不确定是否有适合这种情况的方法。

My current thinking is that I will put as much business logic as possible into an external assembly and then write a custom Web user control for each step for each site. I will include these user controls in a master page's Panel control.

我目前的想法是,我将尽可能多地将业务逻辑放入外部程序集,然后为每个站点的每个步骤编写一个自定义Web用户控件。我将在主页的面板控件中包含这些用户控件。

I don't like this solution because each site will be nearly duplicating the code for the other sites.

我不喜欢这个解决方案,因为每个站点都将几乎复制其他站点的代码。

How can I improve upon this design?

我如何改进这个设计?

The main obstacle is that the sites are similar, but sufficiently different.

主要的障碍是这些网站是相似的,但是有足够的不同。

Thanks!

谢谢!

Alex

亚历克斯

4 个解决方案

#1


1  

you can create base classes which handle all of the common functionality and then have your site specific controls inherit from their respective base classes and then implement their specific implementations.

您可以创建处理所有公共功能的基类,然后让您的站点特定控件从它们各自的基类继承,然后实现它们的特定实现。

#2


1  

We face this problem all the time. What we do is to have a common library that all our sites use, and to bury shared functionality in classes or utility modules in this library. Each site can then use those objects or utility functions as is, or extend the common classes. Keep in mind that these shared classes can include all kinds of things, including code-behind for pages and user controls that you can inherit from and extend.

我们一直面临这个问题。我们所做的是拥有一个我们所有站点都使用的公共库,并在这个库中的类或实用程序模块中隐藏共享功能。然后,每个站点都可以使用这些对象或实用功能,或者扩展公共类。请记住,这些共享类可以包含所有类型的内容,包括可以继承和扩展的页面代码隐藏和用户控件。

Deciding what goes in the app and what goes in the common library is one of the hardest things about our business, though. Put it in the common library and you lose flexibility; put it in the app and you risk having duplicate code to maintain.

不过,在我们的业务中,最困难的事情之一是决定应用程序中的内容和公共库中的内容。把它放在公共库中,就会失去灵活性;把它放到应用程序中,你就有可能需要维护重复的代码。

If you have a fairly complex database setup, it might be worth your time to come up with a framework for specifying your db schema in XML and having your app enforce that schema and build any additional SQL infrastructure that you need based on that definition (e.g. utility views, stored procedures, etc). We did this and it resulted in a huge productivity boost.

如果你有一个相当复杂的数据库设置,它可能是值得你花时间提出一个框架,用于指定db模式在XML和应用程序SQL执行模式和构建任何额外的基础设施需要基于这个定义(例如效用视图、存储过程等)。我们这样做了,它带来了巨大的生产力提升。

#3


0  

Have you looked into Monorail (www.castleproject.org) this is an implementation of themvc pattern, similar to Ruby on rails with a few nice view engines, I prefer Nvelocity. from castle project as well you can use n implementation of ActiveRecord that makes life real nice. if you are on that trail also have a look at coln ramsay screencasts .

您是否看过Monorail (www.castleproject.org)这是themvc模式的一个实现,类似于Ruby on rails和一些漂亮的视图引擎,我更喜欢Nvelocity。在castle project中,你也可以使用n个ActiveRecord实现,让生活更美好。如果你在这条小路上,也可以看看coln ramsay screencast。

To be honest all ms solutions are real fat another great thing about the castleproject is that is totally open source so you can learn loads from their code

老实说,所有的ms解决方案都很胖,castleproject的另一个好处是完全开源的,因此您可以从它们的代码中学习负载

#4


0  

How about using an Application Framework like DotNetNuke or mojoportal? They both provide flexibility and enable you to develop websites very quickly with common functionality. Leaving you to develop custom modules where the functionality you require may be different. There are also thousands of other modules that can be bought which provide excellent functionality.

使用DotNetNuke或mojoportal这样的应用框架怎么样?它们都提供了灵活性,使您能够非常快速地开发具有通用功能的网站。让您开发自定义模块,您需要的功能可能不同。还有数以千计的其他模块可以购买,它们提供了优秀的功能。

However we chose to use WCSF and enhanced upon it.
All the above mentioned projects are open source and some good examples of code to learn from.

但是我们选择使用WCSF并对其进行增强。上面提到的所有项目都是开源的,并且有一些很好的代码示例值得学习。

I know it may be a late answer but I hope it helps

我知道这可能是一个迟来的答案,但我希望它能有所帮助

#1


1  

you can create base classes which handle all of the common functionality and then have your site specific controls inherit from their respective base classes and then implement their specific implementations.

您可以创建处理所有公共功能的基类,然后让您的站点特定控件从它们各自的基类继承,然后实现它们的特定实现。

#2


1  

We face this problem all the time. What we do is to have a common library that all our sites use, and to bury shared functionality in classes or utility modules in this library. Each site can then use those objects or utility functions as is, or extend the common classes. Keep in mind that these shared classes can include all kinds of things, including code-behind for pages and user controls that you can inherit from and extend.

我们一直面临这个问题。我们所做的是拥有一个我们所有站点都使用的公共库,并在这个库中的类或实用程序模块中隐藏共享功能。然后,每个站点都可以使用这些对象或实用功能,或者扩展公共类。请记住,这些共享类可以包含所有类型的内容,包括可以继承和扩展的页面代码隐藏和用户控件。

Deciding what goes in the app and what goes in the common library is one of the hardest things about our business, though. Put it in the common library and you lose flexibility; put it in the app and you risk having duplicate code to maintain.

不过,在我们的业务中,最困难的事情之一是决定应用程序中的内容和公共库中的内容。把它放在公共库中,就会失去灵活性;把它放到应用程序中,你就有可能需要维护重复的代码。

If you have a fairly complex database setup, it might be worth your time to come up with a framework for specifying your db schema in XML and having your app enforce that schema and build any additional SQL infrastructure that you need based on that definition (e.g. utility views, stored procedures, etc). We did this and it resulted in a huge productivity boost.

如果你有一个相当复杂的数据库设置,它可能是值得你花时间提出一个框架,用于指定db模式在XML和应用程序SQL执行模式和构建任何额外的基础设施需要基于这个定义(例如效用视图、存储过程等)。我们这样做了,它带来了巨大的生产力提升。

#3


0  

Have you looked into Monorail (www.castleproject.org) this is an implementation of themvc pattern, similar to Ruby on rails with a few nice view engines, I prefer Nvelocity. from castle project as well you can use n implementation of ActiveRecord that makes life real nice. if you are on that trail also have a look at coln ramsay screencasts .

您是否看过Monorail (www.castleproject.org)这是themvc模式的一个实现,类似于Ruby on rails和一些漂亮的视图引擎,我更喜欢Nvelocity。在castle project中,你也可以使用n个ActiveRecord实现,让生活更美好。如果你在这条小路上,也可以看看coln ramsay screencast。

To be honest all ms solutions are real fat another great thing about the castleproject is that is totally open source so you can learn loads from their code

老实说,所有的ms解决方案都很胖,castleproject的另一个好处是完全开源的,因此您可以从它们的代码中学习负载

#4


0  

How about using an Application Framework like DotNetNuke or mojoportal? They both provide flexibility and enable you to develop websites very quickly with common functionality. Leaving you to develop custom modules where the functionality you require may be different. There are also thousands of other modules that can be bought which provide excellent functionality.

使用DotNetNuke或mojoportal这样的应用框架怎么样?它们都提供了灵活性,使您能够非常快速地开发具有通用功能的网站。让您开发自定义模块,您需要的功能可能不同。还有数以千计的其他模块可以购买,它们提供了优秀的功能。

However we chose to use WCSF and enhanced upon it.
All the above mentioned projects are open source and some good examples of code to learn from.

但是我们选择使用WCSF并对其进行增强。上面提到的所有项目都是开源的,并且有一些很好的代码示例值得学习。

I know it may be a late answer but I hope it helps

我知道这可能是一个迟来的答案,但我希望它能有所帮助