我正在尝试找出一种方法来显示从我的网站上的Google Analytics收集的数据.我正在使用NopCommerce,我想在管理部分的视图中显示此信息/统计信息.
可能有很多方法可以实现这一点,在搜索网页后我发现了一些使用JavaScript的例子,但我找不到一个很好的教程.
我还研究了将Google Analytics与C#集成,我找到了这个例子:http://biasecurities.com/2012/02/using-the-google-analytics-api-with-asp-net-mvc/#comment- 1310 可以从GitHub下载演示项目:https://github.com/jgeurts/Analytics-Example
但是,演示项目似乎不起作用,因为谷歌URL(https://www.google.com/analytics/feeds/accounts/default)已不再使用.
当我使用MVC应用程序时,最好通过在Controller中应用Google Analytics逻辑并在视图中显示它来实现这一点.或类似的东西.
Google提供了一个在此进行实验的查询工具,因此不应该从Google Analytics中提取数据并在网站上显示数据:https://ga-dev-tools.appspot.com/explorer/
有没有人能够在其网站上成功显示Google Analytics数据?
javascript asp.net-mvc google-analytics google-analytics-api nopcommerce
我想让我的基本URL转到在线商店的特定类别(NopCommerce在线商店,如果这有所不同).该类别的URL是: http://myUrl.com/c/6
在阅读了几篇包括Scott Gutherie 关于MVC路由的帖子后,我想我可以将以下代码添加到我的Global.ascx.cs文件中:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//register custom routes (plugins, etc)
var routePublisher = EngineContext.Current.Resolve<IRoutePublisher>();
routePublisher.RegisterRoutes(routes);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Catalog", action = "Category", id = 6 },
new[] { "Nop.Web.Controllers" }
);
}
Run Code Online (Sandbox Code Playgroud)
但这似乎不起作用.我怎样才能完成我想做的事情?
我对MVC的经验很少,所以如果任何一个没有意义,我会道歉.
我在NopCommerce项目中看到有一个解决方案,解决方案中有多个MVC项目.
我有一些问题,例如:
如何共享主要布局或按需使用不同的布局?
如何在不同的MVC项目中使用控制器/模型等?
我还想要一个主要项目和多个子MVC项目.如何在共享组件时完成此操作?
有任何想法吗?指针?
注意:对区域不感兴趣.
我在_Layout.cshtml母版页中有两个元标记,现在我想在someone.cshtml视图页面中添加元标记.
我也尝试使用此代码
放入_layout.cshtml母版页 @RenderSection("metatags",false);
放入someone.cshtml就好 @section metatags { <meta ... /> }
但没有成功.
并尝试添加元标记jquery但没有正常工作.
在使用Entity Framework进行SQL通信时,我有一种奇怪的响应时间模式.
这是来自我的网站主持人:
这是来自我的本地服务器:
这是我担心的响应时间的增加.我已经将问题缩小到代码Nop.Data> EfRepository.cs> public void Insert(T entity)> _entities.Add(entity); 是的,我知道这对于NopCommerce非常具体,但关键在于我正在寻求她的帮助来解决这个问题.
是否有一些我可以捕获的事件显示正在执行的SQL?或者我还可以做些什么来了解上述命令中实体框架中实际发生的事情.
我尝试在nopCommerce 3.0中创建一个linq连接查询.我加入linq的两张桌子并写下来
代码成功了.但视觉工作室的知识分子显示出错误
具有语句主体的lambda表达式无法转换为表达式树
请看下面的代码
var roles = _customerEventRoleRepository.Table.Where(c => c.EventId == selevent)
.Join
(
_customerRepository.Table,
cev => cev.CustomerId, c => c.Id,
(cev, c) =>
{
var cust = new CustomerEventRolesModel();
cust.Id = cev.Id;
cust.CustomerId = c.Id;
cust.Customer = c.Email;
cust.ContactName = c.GetAttribute<string>(SystemCustomerAttributeNames.FirstName);
cust.CompanyName = c.GetAttribute<string>(SystemCustomerAttributeNames.Company);
cust.Speaker = cev.IsSpeaker;
cust.Sponsor = cev.IsSponser;
return cust;
}
).OrderBy(cev => cev.Customer).ToList();
Run Code Online (Sandbox Code Playgroud)
但错误显示
请帮忙
我正在创建一个演示项目,其中包含使用存储库模式和依赖注入的crud操作.
这是我的结构:
方法1(非常受欢迎,许多开发人员使用)
我的存储库界面:
public partial interface IRepository<T>
{
void Insert(T entity);
}
Run Code Online (Sandbox Code Playgroud)
我的服务层:
public partial interface IEmployeeService
{
void InsertCategory(EmployeeMaster employeeMaster);
}
Run Code Online (Sandbox Code Playgroud)
我的类将实现该接口(服务):
public partial class EmployeeService : IEmployeeService
{
private readonly IRepository<EmployeeMaster> _employeeMasterRepository;
public EmployeeService(IRepository<EmployeeMaster> employeeMasterRepository)
{
this._employeeMasterRepository = employeeMasterRepository;
}
public virtual void InsertCategory(EmployeeMaster employeeMaster)
{
_employeeMasterRepository.Insert(employeeMaster);
}
Run Code Online (Sandbox Code Playgroud)
这是我的控制器:
public class HomeController : Controller
{
private readonly IEmployeeService _employeeService;
public HomeController(IEmployeeService employeeService)
{
this._employeeService = employeeService;
}
Run Code Online (Sandbox Code Playgroud)
以上是我从Nop Commerce项目(http://www.nopcommerce.com)关注的结构,我认为现在大多数开发人员现在只关注这种结构,即存储库模式和依赖注入.
以前我做的就像在我的应用程序中制作一个Bal(业务访问层)项目,然后在Bal中制作类文件并执行如下插入:
方法2:
public class …
Run Code Online (Sandbox Code Playgroud) c# asp.net-mvc entity-framework repository-pattern nopcommerce
我是NopCommerce v2.4的新手,想知道我在哪里编写代码(通过在admin或nop.web部分创建新模型)
我是nopCommerce的新手,并尝试将HTML制作成主题,我搜索了很多东西,但无法正确创建自定义主题nopCommerce,可以任何人帮忙,
提前致谢
我正在编写一个插件到NopCommerce 3.2,在视图中我得到上面提到的错误,但也有'布局'和'Html'.我复制了在另一个插件中工作的相同Web.Config.我还添加了与工作插件中使用的相同的引用.编译插件时,但我没有任何intellisense,并且不能相信VisualStudio正确地标记错误.我正在使用VS2013 Professional Update 1.
这是Web.Config文件:
<?xml version="1.0" encoding="utf-8"?>
<!-- We use this file to make razor intellisense work in the class library -->
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation targetFramework="4.5" />
<pages …
Run Code Online (Sandbox Code Playgroud) nopcommerce ×10
asp.net-mvc ×4
c# ×4
asp.net ×3
html ×1
javascript ×1
linq ×1
performance ×1
themes ×1
web-config ×1