mikegriffinreborn / entityspaces Goto Github PK
View Code? Open in Web Editor NEWEntitySpaces - A Fluent SQL library for .NET
EntitySpaces - A Fluent SQL library for .NET
Hi Mike, I am a long time user and fan of Entity Spaces. I was just googling Entity Spaces documentation and found that you had continued working on it. Yay! I much prefer it to Entity Framework and have a lifetime's worth of code built around it.
I am still using the VistaDB3 files. Will the new version work with that?
I'm using v2019.1.1218.0
On the second time I save a project, the connection string reverts to this -
Provider=SQLOLEDB.1;Password=;User ID=sa;Persist Security Info=True;Initial Catalog=Northwind;Data Source=localhost
To reproduce -
Hello,
I'm currently porting our application to the current version of entity spaces and running in some problems:
These are showstopper for us!
Hi Mike,
I was very excited to see ES 2019 now available on GitHub. I've just downloaded all the components to upgrade an existing 2012 ES application which was written in VB.
When I tried to generate the entities in ES Studio, the Custom entities were fine, however I get the following error for the Generated entities (note: I tried generating the entities in C# and got no errors for both Custom and Generated - this looks to be an issue with VB only).
Error Found in C:\Program Files (x86)\EntitySpaces 2019\CodeGeneration\Templates\EntitySpaces\VB\Generated\Generated - esEntity (VB).est on line 245
No overload for method 'EntityRelationName' takes 3 arguments
Error Found in C:\Program Files (x86)\EntitySpaces 2019\CodeGeneration\Templates\EntitySpaces\VB\Generated\Generated - esEntity (VB).est on line 303
No overload for method 'EntityRelationName' takes 3 arguments
at EntitySpaces.CodeGenerator.Template.Execute(Root esMeta, String templateLocation)
at EntitySpaces.AddIn.ucTemplates.OnExecute(TemplateDisplaySurface surface)
When I create a new proyect and add themplates, generated code and save the project
all works ok
BUT, when I open the previously created project file, I get this error
And I coludn't open the project file
and I must start from zero, :-(
I tested also with Studio version EntitySpacesStudio_20191.1218.0
and the error occurs too
thanks in advance
Error Message
Object reference not set to an instance of an object.
at EntitySpaces.MetadataEngine.esSettings2010.SetDefaultSettings()
at EntitySpaces.Common.esProject2010.Load(String fileNameAndFilePath, esSettings mainSettings)
at EntitySpaces.Common.esProject.ConvertProject(String fileNameAndFilePath, esSettings settings)
at EntitySpaces.Common.esProject.Load(String fileNameAndFilePath, esSettings mainSettings)
at EntitySpaces.AddIn.ucProjects.OpenProject(String fileNameAndPath)
Hi, I just get this error : The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached on an ASP.NET application that rely heavily on EntitySpaces.
Is that open/close db connection automatically disposed? so we should be bother to use Using "Bracket" to dispose? or there is any way to safely dispose unused connection, whether it is successfully executed or triggered an exception?
Thank You.
Hi Mike, I hope this ping finds you well.
I am trying to add a new View to the studio, but I cannot figure out how to reload it.
Could you share detail on how to add or update the database and EntitySpaces to see the changes?
Hi, are binaries (dll files) of version 1.5.x available as nuget?
Version 2019.1.1218.0 of EntitySpaces Studio generates buggy code for view clases.
Every generated view class gets at least a constructor which requires a join alias but the GetDynamicQuery or Query methods of the same generated classes are calling a non existing constructor without parameters.
Hi,
code like this is raising an InvalidOperation Exception
this.auftragTemporaer.UrspruenglicheLieferungViaFks.Laender.Eu.Value
Eu is a nullable bool property .
I'm pleasantly surprised to discover ES is alive! Was a long time supporter/user, actually still using ES 2012.
I'm now trying to re-use my currently created ES objects from our ASP application which we are migrating to MVC with the new version of ES, so far only minor changes have needed to be done to some custom classes but the generated classes are working as is, so far. What I'm running into is an issue trying to figure out how to dynamically set the ES objects connection. Our application is basically a multi-tenant application and needs to set the connection based on who is logged in. I was thinking I could use the EntitySpaces.Interfaces.esConnection.ConnectionService
but that doesn't seem to be working. I know I could set the connection in the Global.asax
file but like I said I need the connection to be dynamically set. Was hoping for some pointers on the best was to accomplish this in an MVC application using ES. I'm guessing I could set the EntitySpaces.Interfaces.esConnectionElement
when users log into the system but not sure that's the best way?
Side note: I used to be able to set the connection name on the classes also and that isn't working either.
collection.es.Connection.Name = connectionName
and the connection name we were setting would be one of the connection names set in the webconfig file in the EntitySpaces section. But from the documation website it doesn't look like we can set that up and use that method anymore?
Thanks,
Back then before the ES assemby for each provider merged as EntitySpaces.ORM.SqlServer, or EntitySpaces.ORM.MySql, I could use both database in single project, but now when i install both EntitySpaces.ORM.SqlServer and EntitySpaces.ORM.MySql assembly, it no longer works. Is there a solution to enable multiple connection to different database type like old time?
Thank You very much.
Best Regards,
Toro
Hi,
when using DatabaseVersion = "2012"
as noticed in the project description saving data raises the exception from the title because in Providers\EntitySpaces.SqlClientProvider\Shared.cs
the version check is only for if (request.DatabaseVersion == "2005" || request.DatabaseVersion == "2008")
(line 360 and 490).
Hi Mike
I am migrating from EntitySpaces 2009 (!) to your newest version 2019/2020.
Now I fell across one of the bugs reported by HeikoAdams on Feb 24th.
I fixed the templates according to his "cookbook".
Have you been able to build a new installable version of the studio by now?
Best regards and looking forward...
Thomas
Hey not an issue, but do you have a guide on how to migrate from EntitySpaces 2009 to 2020? We're still using 2009 it for our main product (putting off and finding excuses not to go to EF for years).
EntitySpaces was a great tool in 2007-2008, when MS entity framework wasn’t available yet, and our legacy application still use it for a few tables. But when will you recommend to use it now? Is it only for upgrading old applications, that are using original ES? Or you suggest to use in in new applications as well?. Please add the answer to readme.md, as it will be interesting to all readers.
Btw, why did you create this repository under new name, not under EntitySpaces? It will be better to cross-link old and new EntitySpaces repositories.
Table with no primary key produces an error in the generated file like below:
public virtual bool LoadByPrimaryKey(esSqlAccessType sqlAccessType, )
{
if (sqlAccessType == esSqlAccessType.DynamicSQL)
return LoadByPrimaryKeyDynamic();
else
return LoadByPrimaryKeyStoredProcedure();
}
Since we're working with a table with out any key here.. is it safe to simply remove this method from the generated file?
e.g. For a class that contains a foreign key to the table named "Shop", when generating from v2012, it would emit -
public Shop UpToShopByShopId
Now, in v2019, it emits -
public Shop Shop
I am using the default settings -
<UseUpToPrefix>true</UseUpToPrefix>
Finally i find you, thank you so much, @MikeGriffinReborn , thank you for your ReBorn!
I have loved since 2009 with ES
Hi,
this is the code generated by ES Studio for the Kunden property of my auftraege Class:
public Kunden Kunden
{
get
{
if (this._Kunden == null)
{
this._Kunden = new Kunden();
this._Kunden.es.Connection.Name = this.es.Connection.Name;
this.SetPreSave("Kunden", this._Kunden);
if(this._Kunden == null && FkKunden != null)
{
if (!this.es.IsLazyLoadDisabled)
{
this._Kunden.Query.Where(this._Kunden.Query.IdKunden == this.FkKunden);
this._Kunden.Query.Load();
}
}
}
return this._Kunden;
}
set
{
this.RemovePreSave("Kunden");
if(value == null)
{
this.FkKunden = null;
this._Kunden = null;
}
else
{
this.FkKunden = value.IdKunden;
this._Kunden = value;
this.SetPreSave("Kunden", this._Kunden);
}
}
}
The getter returns allways an empty Kunden class because of the if(this._Kunden == null && FkKunden != null)
check which is allways false because this._Kunden
is empty but not null. The check should be if (!this._Kunden.es.HasData && this.FkKunden != null)
to work properly.
BTW: This is a show stopper!
Can anyone who is using Entityspaces 2009 help me out with UdtTypeName property must be set for UDT parameters issue? My site is all working fine until I migrated my database from SQL 2005 to SQL 2016. See below for error details. Many thanks for your help in advance.
[ArgumentException: UdtTypeName property must be set for UDT parameters.] EntitySpaces.Interfaces.esDataProvider.esLoadDataTable(esDataRequest request, esProviderSignature sig) +106 EntitySpaces.Interfaces.esDynamicQuery.Load() +496 EntitySpaces.Core.esEntityCollection.LoadAll() +42 _Default._Default_Load(Object sender, EventArgs e) in h:\root\home\teddyli-001\www\eggs\Default.aspx.vb:15 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Errors while trying to build the solution.
The type or namespace name 'IOverClause' could not be found (are you missing a using directive or an assembly reference?) EntitySpaces.ORM.PostgreSQL (net451), EntitySpaces.ORM.PostgreSQL (net461), EntitySpaces.ORM.PostgreSQL (netcoreapp2.0), EntitySpaces.ORM.PostgreSQL (netcoreapp3.0), EntitySpaces.ORM.PostgreSQL (netstandard2.0)
Character ' ', hexadecimal value 0x3 is illegal in XML documents. EntitySpaces.ORM.PostgreSQL
Hi Mike,
First, here are the versions I have, if needed:
I was generating from the C# template and got this error:
It seems that there were some lacking parameters.
I tried to remove the "," and set it only with the esSqlAccessType sqlAccessType
and it seems to compile fine. Need to test yet on runtime.
Dear @MikeGriffinReborn ,
I have table like this:
Can you add a feature to query all childs of a parent column by using EntitySpaces?
Thank you in advance,
Regards,
The ColumnNames class of the Metadata Class can be marked as static by canging line 216 of Generated - Metadata (C#).est from public class ColumnNames
to public static class ColumnNames
I have this generated code for a table called products created by the ES 2019 studio.
The table products has a many to one relationship with a table called categories.
I want to be able to access the name of the category from product.
So I am doing product.categories.category_name
But when I step through the code in the generated file:, I never seem to reach the part where it loads the Categories.
The generated code in 2019 looks like this:
Is this a bug? Is there some other way I need to be doing this?
I think the problem is with this line:
if(this._Categories == null && CategoryId != null)
This is causing it to never go in to that if block since we have already initialized this._Categories just before that:
this._Categories = new Categories();
In 2009 version it used to work fine.
The code in 2009 like this:
Please let me know if anyone have any solution for this. Thank you!
Hi,
As a long time user of EntitySpaces 2012, I've just yesterday found out that there is a new version available since 2019/2020 and I was very pleased to see that such a good product was revived.
But I'm having a problem with the Hierarchical template for One-To-One relationships between 2 tables and for self referencing tables (as eg the parent of an item).
Upon compilation of the generated tables I get the CS0542 error: 'member names cannot be the same as their enclosing type'.
Upon examination, the property name for the referencing object is the same as the class name it is defined in (see resulting code below).
public partial class TblSitesSalesInfo : esTblSitesSalesInfo
{
#region TblSitesSalesInfo - One To One (tblSitesSalesInfo_FK00)
[EditorBrowsable(EditorBrowsableState.Never)]
public bool ShouldSerializeTblSitesSalesInfo()
{
return (this._TblSitesSalesInfo != null) ? true : false;
}
[DataMember(Name="TblSitesSalesInfo", EmitDefaultValue = false)]
public TblSites TblSitesSalesInfo
{
get
{
......
[In the class TblSiteSalesInfo it needs to create a reference to an object of type TblSites, but the property name is TblSiteSalesInfo instead of TblSites or the alias given in the MetaData]
I've already browsed through all open and closed issues, have given the foreign key relationship a different alias as suggested in issue #4 and tried correcting the Hierarchical template myself, but I've not found a solution for this.
Can anyone please help me?
Thanks
Hi guys,
I get error from compiler when i implement this query:
Department x = (Department)mDepHigher.GetSelectedDataRow();
Department y = new Department();
y.Query.Where(y.Query.DeptParentCode == x.DeptParentCode && y.DeptName == mDepLower.Name);
The compiler said:
error CS0019: Operator '&&' cannot be applied to operands of type 'esComparison' and 'bool'
But it is OK when my codes are:
Department x = (Department)mDepHigher.GetSelectedDataRow();
DepartmentQuery d = new DepartmentQuery();
DepartmentCollection cd = new DepartmentCollection();
d.Where(d.DeptParentCode == x.DeptParentCode && d.DeptName == mDepLower.Text);
can you tell me what i was wrong in the fist code?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.