I am working on a tag cloud application. There are 3 database tables.
Content: ContentID, Text
Tag: TagID, Name
TagRelation: TagRelationID, TagID, ContentID
The code below is wrong. Because 'Contains' clause doesn't take a list of parameters like the 'IN' SQL clause. Is there an alternative clause that I can use to make this code wor...
Here is my problem, I have a multilang database shema. First I want a query with this result
French | English
Car | NULL
Etoile | Stars
NULL | Monkey
...
I'm pretty sure I will need to use A left join combinate with Pivot table.
Where I'm suppose to put this query. In a Partial class, or I need to use the Repository Pattern to...
When I try to call my repository in a Sub Select, I got this error.
IGrpTextRepository rep = new GrpTextRepository();
var query = new DetailViewModel
{
ViewDet = (from gh in _db.Grp
select new MultiDetailViewModel
{
Header = gh,
...
I want to implement integration tests of my Entity Framework driven repositories. The problem is how to rollback database state after tests are done. At the moment I'm planning to start transaction at test SetUp and roll it back at test TearDown. Are there any other solutions excepting manual database clearing?
...
I am attempting to use Reflection in C# to determine at runtime the type of objects in a collection property. These objects are entities generated by the Entity Framework:
Type t = entity.GetType();
PropertyInfo [] propInfo = t.GetProperties();
foreach(PropertyInfo pi in propInfo)
{
if (pi.PropertyType.IsGenericType)
{
...
Hi I'm new to EF but am trying to go by the book and create tests for my repositories.
The tests fails here.
desiner.cs base(global::System.Configuration.ConfigurationManager.ConnectionStrings["pij_localConnectionString"].ConnectionString, mappingSource)
I presume I need to move the connection strings out of the webconfig.
What is t...
Hi. I got:
public interface IRepository<TE, TK>
where TE : class, IEntityId<TK>, new()
where TK : struct
{
IQueryable<TE> Query();
void Create(TE entity);
void Update(TE entity);
void Delete(TE entity);
}
The Query method should return a data list via Entity Framework 4 ORM.
Use case: I need all august orders...
I have a pretty standard linked table setup
Table1
Id - PK, seeded
Table2
Id - PK, seeded
Table3
Table1Id - FK
Table2Id - FK
For some reason, when using the designer to create the edmx in VS2010, table 1 exists already. When adding Table2 and Table3, they get added, but no relationship gets attached between Table3 and Table1. As w...
Hi.
I'm developing a project using a layered architecture. I have a DAL in which i'm using Entity Framework, a business logic layer which consumes the objects returned by the DAL and an app layer.
I'm not entirely sure i'm thinking this right, so i'll just ask you what you think.
My DAL is based on mappers. I have types - mappers - th...
i writed below codes MyCustomer.cs must return List which is type of Customer entity. İ used Func method. I want to do this:
return erpEntityCtx.Customer.Select(select).ToList<TResult>();
BUT error return to me:
Has some invalid argument.
i can use this:
return erpEntityCtx.Customer.Select(c=>c.Name).ToList<TResult>();
However ...
i try to write manager class. But i can not use that : return erpObj.Get(predicate); How can i do that?
namespace Erp.BLL.Manager
{
public interface ILoad
{
List<TResult> Load<TKey,TResult>(List<TKey> list, Func<TKey, TResult> select);
}
public interface IRepository<TModel>
{
List<TModel> Get(Fun...
I have a table with records that has delete links. Basically I followed the NerdDinner tutorial for that part in MVC. But I don't want to have the confirm view, I'd rather have a confirm dialog, and then if confirmed let the HttPost action method delete the record directly.
I have something working, but being new to both MVC and jQuery,...
Is there anything wrong with this code? My entity is not getting updated.
public ActionResult UpdateNota(string notas)
{
if (Request.IsAjaxRequest())
{
RegistroEntities registroEntities = new RegistroEntities();
Nota nota = JsonConvert.DeserializeObject<Nota>(notas);
registroEntities.AttachTo("Notas",nota...
This is for Entity Framework for .NET 3.5:
I have the need to query a table and include a collection of the "many" table of a one-to-many relationship. I'm trying to filter that collection as part of the query - I'm pretty new to Entity Framework, and I'm having trouble figuring it out.
Simplified example: Author has Books, and Book h...
Hi,
I use to render data using EntityDataSource, and I use to store customer image as byte in database, the problem is how can I convert that byte to base64 on .aspx page itself to use it as image src, is there any way to do this in javascript.
...
I have the following EF structure:
I want to get name of the every user who attended to a meeting:
using(var ctx = new MyContext())
{
var meeting = (from row in ctx.Meetings.Include("MeetingMessages").Include("MeetingUsers")
where row.mId == 1
select row).FirstOrDefault();
foreach(var meetingUser in m...
Hello.
I have an application that consists of 3 layers:
UI: to be implemented in ASP.NET MVC
Business: Holds the business logic and resource access control
Repository (DAL): Implemented with POCO objects and EF, using the repository pattern. My POCO objects are shared with the upper layers.
I have questions about what information/meth...
How to add object to a collection so that after .SaveChanges() it hasn't inserted/updated?
...
Hello,
I am using the Entity Framework with a MySQL server because I want to be able to do nice and easy LINQ queries againy my MySQL database.
I have a very simple problem and I'm frustrated because I can't believe that the EF is making such a horrible mistake.
To simplify, I have parent and child classes, and I want to execute two in...
i try to use erpCtx.Executecommand but i doesn't have method of executecommand. i think that i must add dll in Reference to show executeCommand?
i need : int rowsAffected = engCtx.ExecuteCommand("insert into ENG_MAINWP Values({0},{1},{2},{3})", engArray[0], engArray1, engArray[2], engArray[3]);
...