我的C#/ .Net应用程序包含类<form class="form-inline pull-xs-right" action="search.php" method="POST" >
<input class="form-control" type="text" name="search" placeholder="Search">
<button class="btn btn-success-outline" name="searchh" type="submit" value=">>" >Search</button>
</form>
<?php
$i=null;
$search=null;
$result_query=null;
if(isset($_POST['search'])){
$get_value = addslashes($_POST['search']);
$search = mysqli_real_escape_string($con,"$get_value");
?>
<h2>Showing results for
<?php echo $_POST['search'] ?></h2>
<?php
if($search==''){
echo "<center><b>Please write something in the search box!</b></center>";
exit();
}
$search = $_POST['search'];
$terms = explode(" ", $search);
foreach ($terms as $each) {
$i++;
if ($i == 1)
$result_query .= "keywords LIKE '%$each%' ";
else
$result_query .= "OR keywords LIKE '%$each%' ";
}
$result_query = "SELECT * FROM content WHERE keywords LIKE '%".$search."%'";
$run_result = mysqli_query($con,$result_query);
// echo mysqli_num_rows($run_result);
// exit;
if(mysqli_num_rows($run_result)<1){
echo "<center>Sorry no matches found</center>";
exit();
}
while($row_result=mysqli_fetch_array($run_result))
{
$name=$row_result['name'];
$keywords=$row_result['keywords'];
$image=$row_result['image'];
$link=$row_result['link'];
?>
和Selection
。 Calculation
是抽象的,并且有一些子类。
对于每个Calculation
实例,我需要一组不同的可能计算。我目前有Selection
,MaxCalculation
,但还有无法预见的AverageCalculation
个子类型。
所以,我希望我的应用程序“知道”可用的Calculation
子类型(可能通过动态dll加载和/或IoC容器),并且可以使用这种类型的集合,这样每次我创建一个新的Calculation
的实例,我可以为它创建每个Selection
子类型的新实例。
我创建了以下spike,但似乎没有任何静态强制执行,这些类是Calculation
的子类型:
Calculation