本文整理汇总了C#中UrlInfo类的典型用法代码示例。如果您正苦于以下问题:C# UrlInfo类的具体用法?C# UrlInfo怎么用?C# UrlInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UrlInfo类属于命名空间,在下文中一共展示了UrlInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateController
public Controller CreateController(UrlInfo urlInfo)
{
IWindsorContainer container = WindsorContainerAccessorUtil.ObtainContainer();
IControllerTree tree;
try
{
tree = (IControllerTree) container["rails.controllertree"];
}
catch(ComponentNotFoundException)
{
throw new RailsException("ControllerTree not found. Check whether RailsFacility is properly configured/registered");
}
Type implType = tree.GetController(urlInfo.Area, urlInfo.Controller);
if (implType == null)
implType = tree.GetController("", "rescues");
if (implType == null)
throw new ControllerNotFoundException(urlInfo);
return (Controller) container[implType];
}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:25,代码来源:WindsorControllerFactory.cs
示例2: ResponseAdapter
/// <summary>
/// Initializes a new instance of the <see cref="ResponseAdapter"/> class.
/// </summary>
/// <param name="response">The response.</param>
/// <param name="currentUrl">The current URL.</param>
/// <param name="urlBuilder">The URL builder.</param>
/// <param name="serverUtility">The server utility.</param>
/// <param name="routeMatch">The route match.</param>
/// <param name="referrer">The referrer.</param>
public ResponseAdapter(HttpResponse response, UrlInfo currentUrl,
IUrlBuilder urlBuilder, IServerUtility serverUtility,
RouteMatch routeMatch, string referrer)
: base(currentUrl, urlBuilder, serverUtility, routeMatch, referrer)
{
this.response = response;
}
开发者ID:smoothdeveloper,项目名称:Castle.MonoRail,代码行数:16,代码来源:ResponseAdapter.cs
示例3: CreateRedirect
public string CreateRedirect(string url, string safeUrl, int ttl)
{
var urlInfo = new UrlInfo
{
OriginalUrl = url,
SafeUrl = safeUrl,
ExpiresAt = SystemInfo.SystemClock().AddSeconds(ttl),
};
do
{
urlInfo.Id = uniqueIdGenerator.Generate();
if (repository.GetUrlInfo(urlInfo.Id) != null)
continue;
try
{
repository.AddUrlInfo(urlInfo);
repository.SaveChanges();
return urlInfo.Id;
}
catch (Exception)
{
// get another unique id and try again
}
} while (true);
}
开发者ID:njmube,项目名称:public,代码行数:27,代码来源:BusinessLogic.cs
示例4: Test_UrlInfo
private static void Test_UrlInfo()
{
var model = new UrlInfo
{
Url = "http:www.baidu.com",
UrlMd5 = "atSDsdfsfsfsdsffw",
ShortVal = "adEwF",
Comment = "百度",
State = 1,
CreateTime = DateTime.Now
};
var urlInfoDao=new UrlInfoDao();
var isOkDelete = urlInfoDao.DeleteById(1);
var id = urlInfoDao.Add(model);
var isOkUpdate = urlInfoDao.UpdateById(new UrlInfo() {Comment = "百度update"}, id);
var model01 = urlInfoDao.FindById(id);
var whereModel = new UrlInfo { Id = id };
var model02 = urlInfoDao.FindList(whereModel, "[email protected]", 1);
//---
//---
//todo where--比较推荐的写法--可以提高程序的可读性
var where = new WhereEntity<UrlInfo>()
{
Model = new UrlInfo() { Id = id },
Sql = "[email protected]",
OrderBy = "id"
};
//
var model03 = urlInfoDao.FindListByPage(where.Model, where.Sql, where.OrderBy, 0, 10);
var count = urlInfoDao.Count(where.Model, where.Sql);
}
开发者ID:yaozd,项目名称:DapperTemplateMultiDatabaseForMySql,代码行数:33,代码来源:Program.cs
示例5: Add
public string Add(UrlInfo info)
{
string h_result = CheckInfo(info);
if (Exist(info.HtUrl, info.HtULCase))
return "url已经存在!";
if (h_result != "")
return h_result;
IDataParameter[] m_parameters = new SqlParameter[4];
m_parameters[0] = new SqlParameter("@htUrl", SqlDbType.NVarChar, 2000);
m_parameters[0].Value = info.HtUrl.Trim();
m_parameters[1] = new SqlParameter("@htTitle", SqlDbType.NVarChar, 200);
m_parameters[1].Value = info.HtTitle;
m_parameters[2] = new SqlParameter("@htSumary", SqlDbType.NVarChar, 1000);
m_parameters[2].Value = info.HtSummary;
m_parameters[3] = new SqlParameter("@HtULCase", SqlDbType.Bit);
m_parameters[3].Value = info.HtULCase;
int m_returnCount;
//执行结果等于1表示添加成功
m_returnCount = KeleyiSQLHelper.HoverTreeSql.RunProcedureWithReturn("p_HoverTreeSCJ_URLs_Add", m_parameters);
if (m_returnCount == 1)
return string.Empty;
else
return "添加失败 ";
}
开发者ID:hovertree,项目名称:HoverTreeSCJ,代码行数:30,代码来源:HtUrl.cs
示例6: RedirectToUrlDoesNotTouchUrl
public void RedirectToUrlDoesNotTouchUrl()
{
UrlInfo url = new UrlInfo("area", "home", "index", "", ".castle");
StubResponse response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch());
response.RedirectToUrl("/uol/com/folha");
Assert.AreEqual("/uol/com/folha", response.RedirectedTo);
}
开发者ID:ralescano,项目名称:castle,代码行数:7,代码来源:RedirectSupportTestCase.cs
示例7: GetUrlInfoList
private List<UrlInfo> GetUrlInfoList()
{
List<UrlInfo> list = new List<UrlInfo>();
UrlInfo info = null;
bool first = true;
foreach (string key in UrlTracerContain.Total.Keys)
{
double cost = UrlTracerContain.Cost[key];
info = new UrlInfo();
info.Path = key;
info.Total = UrlTracerContain.Total[key];
if (UrlTracerContain.Failures.ContainsKey(key))
{
info.Failures = UrlTracerContain.Failures[key];
}
else
{
info.Failures = 0;
}
info.Max = Math.Round(UrlTracerContain.Max[key],1);
info.Min = Math.Round(UrlTracerContain.Min[key],1);
double avg = cost / info.Total;
info.Avg = Math.Round(avg, 1);
info.ReqSize = UrlTracerContain.ReqSize[key];
if (first)
{
info.Link = "<a target=\"_blank\" href=\"" + GetCatLink() + "\" target=\"_self\">CAT</a>";
}
first = false;
list.Add(info);
}
return list;
}
开发者ID:felix-tien,项目名称:TechLab,代码行数:33,代码来源:UrlComponents.cs
示例8: Count
//
public int Count(UrlInfo whereModel, string where)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select count(*) from UrlInfo ");
strSql.AppendFormat("where 1=1 and {0} ", where);
var result = _dbHelper.Count(strSql.ToString(), whereModel);
return result;
}
开发者ID:yaozd,项目名称:DapperTemplateMultiDatabaseForMySql,代码行数:9,代码来源:UrlInfoDao.cs
示例9: TreeViewModel
public TreeViewModel()
{
MainUrl = new UrlInfo();
AddUrl = new UrlInfo();
EditUrl = new UrlInfo();
RemoveUrl = new UrlInfo();
ExpandUrl = new UrlInfo();
}
开发者ID:arashkarami,项目名称:MVCTreeView,代码行数:8,代码来源:TreeViewModel.cs
示例10: ReturnsSafeUrlExactlyOnExpirationDate
public void ReturnsSafeUrlExactlyOnExpirationDate()
{
var sut = new UrlInfo { OriginalUrl = "a", SafeUrl = "b", ExpiresAt = new DateTime(2000, 1, 2, 3, 4, 5) };
var result = sut.GetUrl(new DateTime(2000, 1, 2, 3, 4, 5));
Assert.AreEqual("b", result);
}
开发者ID:njmube,项目名称:public,代码行数:8,代码来源:UrlInfoTests.cs
示例11: EnQueue
public void EnQueue(UrlInfo target)
{
lock (this.SyncObject)
{
this.InnerQueue.Enqueue(target);
this.AutoResetEvent.Set();
}
}
开发者ID:xxy1991,项目名称:cozy,代码行数:8,代码来源:UrlAddressQueue.cs
示例12: UrlInfo
public ActionResult UrlInfo(long? id, string other)
{
if (id == null)
id = 0;
Models.UrlInfo Tmodel=new UrlInfo(urlinfoRY,SiteRY,QuestionRY);
Tmodel.urlinfo = Tmodel.getquestionurlbyid(id.Value);
return Content(Tmodel.urlinfo);
}
开发者ID:qqqzhch,项目名称:Test-Driven-Development-TDD,代码行数:9,代码来源:BrowseController.cs
示例13: Parse
public static SearchQuery Parse(UrlInfo urlInfo)
{
List<string> tags = new List<string>();
foreach (string tagText in urlInfo.TagFilter)
{
tags.Add(tagText);
}
return new SearchQuery(tags);
}
开发者ID:davelondon,项目名称:dontstayin,代码行数:9,代码来源:SearchQuery+-+Parse.cs
示例14: RedirectToUrlWithQueryStringAsDict
public void RedirectToUrlWithQueryStringAsDict()
{
UrlInfo url = new UrlInfo("area", "home", "index", "", ".castle");
StubResponse response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch());
response.RedirectToUrl("/uol/com/folha", DictHelper.Create("id=1", "name=john doe"));
Assert.AreEqual("/uol/com/folha?id=1&name=john+doe", response.RedirectedTo);
response.RedirectToUrl("/uol/com/folha?something=1", DictHelper.Create("id=1", "name=john doe"));
Assert.AreEqual("/uol/com/folha?something=1&id=1&name=john+doe", response.RedirectedTo);
}
开发者ID:ralescano,项目名称:castle,代码行数:10,代码来源:RedirectSupportTestCase.cs
示例15: FindList
//
public IList<UrlInfo> FindList(UrlInfo whereModel, string where, int top)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select ");
strSql.Append("id,url,urlMd5,shortVal,comment,state,createTime,isDel ");
strSql.Append("from UrlInfo ");
strSql.AppendFormat("where 1=1 and {0} ", where);
strSql.AppendFormat("limit {0} ", top);
var result = _dbHelper.FindList<UrlInfo>(strSql.ToString(), whereModel);
return result;
}
开发者ID:yaozd,项目名称:DapperTemplateMultiDatabaseForMySql,代码行数:12,代码来源:UrlInfoDao.cs
示例16: Add
//
public int Add(UrlInfo model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into UrlInfo ( ");
strSql.Append("url,urlMd5,shortVal,comment,state,createTime,isDel)");
strSql.Append(" values (");
strSql.Append("@url,@urlMd5,@shortVal,@comment,@state,@createTime,@isDel)");
//
var id = _dbHelper.InsertReturnId(strSql.ToString(), model);
return id;
}
开发者ID:yaozd,项目名称:DapperTemplateMultiDatabaseForMySql,代码行数:12,代码来源:UrlInfoDao.cs
示例17: Redirect_ToControllerAction
public void Redirect_ToControllerAction()
{
UrlInfo url = new UrlInfo("area", "home", "index", "", ".castle");
StubResponse response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch());
response.Redirect("cart", "view");
Assert.AreEqual("/area/cart/view.castle", response.RedirectedTo);
url = new UrlInfo("", "home", "index", "", ".castle");
response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch());
response.Redirect("cart", "view");
Assert.AreEqual("/cart/view.castle", response.RedirectedTo);
}
开发者ID:ralescano,项目名称:castle,代码行数:12,代码来源:RedirectSupportTestCase.cs
示例18: RedirectToSiteRootUsesAppVirtualDir
public void RedirectToSiteRootUsesAppVirtualDir()
{
UrlInfo url = new UrlInfo("area", "home", "index", "", ".castle");
StubResponse response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch());
response.RedirectToSiteRoot();
Assert.AreEqual("/", response.RedirectedTo);
url = new UrlInfo("area", "home", "index", "/app", ".castle");
response = new StubResponse(url, urlBuilder, urlBuilder.ServerUtil, new RouteMatch());
response.RedirectToSiteRoot();
Assert.AreEqual("/app/", response.RedirectedTo);
}
开发者ID:ralescano,项目名称:castle,代码行数:12,代码来源:RedirectSupportTestCase.cs
示例19: DefaultEngineContext
/// <summary>
/// Initializes a new instance of the <see cref="DefaultEngineContext"/> class.
/// </summary>
/// <param name="container">The container.</param>
/// <param name="urlInfo">Url information</param>
/// <param name="context">The context.</param>
/// <param name="server">The server.</param>
/// <param name="request">The request.</param>
/// <param name="response">The response.</param>
/// <param name="trace">The trace.</param>
/// <param name="session">The session.</param>
public DefaultEngineContext(IMonoRailContainer container, UrlInfo urlInfo, HttpContext context, IServerUtility server, IRequest request, IResponse response, ITrace trace, IDictionary session)
: base(container)
{
this.container = container;
this.UnderlyingContext = context;
this.UrlInfo = urlInfo;
this.Request = request;
this.Response = response;
this.Session = session;
this.Server = server;
this.Trace = trace;
}
开发者ID:smoothdeveloper,项目名称:Castle.MonoRail,代码行数:23,代码来源:DefaultEngineContext.cs
示例20: SetUp
public virtual void SetUp()
{
PropertyBag = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
Helpers = new HelperDictionary();
var services = new StubMonoRailServices
{
UrlBuilder = new DefaultUrlBuilder(new StubServerUtility(), new StubRoutingEngine()),
UrlTokenizer = new DefaultUrlTokenizer()
};
var urlInfo = new UrlInfo(
"example.org", "test", "/TestBrail", "http", 80,
"http://test.example.org/test_area/test_controller/test_action.tdd",
Area, ControllerName, Action, "tdd", "no.idea");
StubEngineContext = new StubEngineContext(new StubRequest(), new StubResponse(), services, urlInfo);
StubEngineContext.AddService<IUrlBuilder>(services.UrlBuilder);
StubEngineContext.AddService<IUrlTokenizer>(services.UrlTokenizer);
ViewComponentFactory = new DefaultViewComponentFactory();
ViewComponentFactory.Service(StubEngineContext);
ViewComponentFactory.Initialize();
StubEngineContext.AddService<IViewComponentFactory>(ViewComponentFactory);
ControllerContext = new ControllerContext
{
Helpers = Helpers,
PropertyBag = PropertyBag
};
StubEngineContext.CurrentControllerContext = ControllerContext;
Helpers["urlhelper"] = Helpers["url"] = new UrlHelper(StubEngineContext);
Helpers["formhelper"] = Helpers["form"] = new FormHelper(StubEngineContext);
Helpers["dicthelper"] = Helpers["dict"] = new DictHelper(StubEngineContext);
Helpers["DateFormatHelper"] = Helpers["DateFormat"] = new DateFormatHelper(StubEngineContext);
var loader = new FileAssemblyViewSourceLoader("Views");
_monoRailViewEngine = new NHamlMonoRailViewEngine();
_monoRailViewEngine.TemplateEngine.Options.TemplateCompiler = new CSharp3TemplateCompiler();
_monoRailViewEngine.SetViewSourceLoader(loader);
_templateEngine = _monoRailViewEngine.TemplateEngine;
_templateEngine.Options.TemplateBaseType = typeof( NHamlMonoRailView );
ViewComponentFactory.Inspect(GetType().Assembly);
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:50,代码来源:TestFixtureBase.cs
注:本文中的UrlInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论