Page 1 of 1

Facets from the MetadataWorkspace not requestable, MaxLength

Posted: Wed 12 Aug 2009 06:06
by HCRoman
Hi devart team,

I tried your EntityFramework-Mapper for Oracle and at a first look it works great! :D :D

I have some question:
Why are the facets not queryable if i use
Your DevartEfGenerator for the model?
*.edml :?: :?:

entities = new DevartDemo.DevartEntities();
depts = entities.Depts.ToList();
int? dmaxLength = GetMaxLength(new Dept(), "Dname", entities.Depts);
returns 0

EntityModelCodeGenerator on the same table works and i get the facets.
*.edmx


EntitiesTestModel mentities = new EntitiesTestModel();
List deptsm = mentities.DEPT.ToList();
int? mmaxLength = GetMaxLength(new DEPT(), "DNAME", mentities.DEPT);

returns 14 8) 8)



This I have found in the internet! 8) 8) 8)

private int?
GetMaxLength(EntityObject entite, string nomPropriete, ObjectQuery query)
{
int? result = null;
using (var contexte = query.Context)
{
var q = from meta in contexte.MetadataWorkspace.GetItems(DataSpace.CSpace).Where(
m => m.BuiltInTypeKind == BuiltInTypeKind.EntityType)
from p in (meta as EntityType).Properties.Where(
p => p.DeclaringType.Name == entite.GetType().Name
&& p.Name == nomPropriete && p.TypeUsage.EdmType.Name == "String")
select p;
var queryResult = from meta in contexte.MetadataWorkspace.GetItems(DataSpace.CSpace).Where(
m => m.BuiltInTypeKind == BuiltInTypeKind.EntityType)
from p in (meta as EntityType).Properties.Where(
p => p.DeclaringType.Name == entite.GetType().Name
&& p.Name == nomPropriete && p.TypeUsage.EdmType.Name == "String")
select p.TypeUsage.Facets["MaxLength"].Value;

if (queryResult.Count() > 0)
{
result = Convert.ToInt32(queryResult.First());
}
}
return result;
}


Missed I something, or must I write a query to the database to get the facets.

Thanks

Roman

Posted: Wed 12 Aug 2009 08:09
by AndreyR
The current 5.25.39 build of dotConnect for Oracle already returns the MaxLength facet value for the Devart Entity model.
We are working on the implementation of the support for other facets.

Posted: Wed 12 Aug 2009 08:48
by HCRoman
:lol: :lol: :lol: :lol:

I downloaded one day befor this build....

Now it works, great, after I updated the model.

When do you think the other facets are supported??

precision, scale are the most wanted

Tnx Roman

Posted: Wed 12 Aug 2009 09:54
by AndreyR
I will let you know as soon as timeframe is available.

Posted: Thu 03 Sep 2009 07:06
by AndreyR
Precision and Scale facets are implemented in the upcoming build.

Posted: Thu 17 Sep 2009 11:59
by AndreyR
Please note that the MaxLength facet is serialized only for the String and Binary properties.
The Precision and Scale facets are serialized for Decimal prperties only.

Precision and Scale only avail for Decimal

Posted: Thu 29 Oct 2009 17:07
by pcrissman
Hi,
Is there a reason the precision and scale are only available for Decimal?
We have fields in Oracle defined as NUMBER(9,2) and NUMBER(9,3).. and would have loved to query the metadata for precision and scale to do some formatting?

Pam Crissman

Posted: Mon 02 Nov 2009 10:59
by AndreyR
We will investigate the possibility to add support for these facets for Double.

Posted: Thu 05 Nov 2009 13:22
by Shalex
Entity Framework validates the content of the EDMX file. It is forbidden to set the Precision and Scale facets for the Double columns of conceptual model entities. In this case there will be errors like "Precision facet isn't allowed for properties of type Double.". That's why we will not support this functionality.

This is ok for doubles, but i would like to force decimals

Posted: Thu 05 Nov 2009 13:32
by HCRoman
Hi Shalex,

this is ok and I do not need support for precision and scale for double.

But how can I force the generator to use decimals instead of double for all number with any scale > 0.

Only if double does not fit, the generator switches to decimal and this is the problem!!!

The refactoring settings should have a flag to force decimals instead of double and than correctly import precision and scale.

We have changed our model to decimals and it is a horror to merge after reimport.....

Roman

Posted: Thu 05 Nov 2009 15:22
by Shalex
Roman, my previous answer about Double was addressed to Pam Crissman.

The possibility of mapping types customisation. The crusial issue in this point: there will be not enough to have one flag in refactoring settings, because different model modifications are required for different users. So we think that this is a wrong way. One of possible solutions is an implementation of possibility for Entity Developer to execute the C# scripts which can modify an existing model loaded to Entity Developer. In this case we provide several simple examples of such scripts in our documentation.

double/decimal

Posted: Fri 06 Nov 2009 10:25
by HCRoman
Hi Shalex,

is this now a feature or only in the future available?

I think, it should be possibly coded in the templates....??

Roman

Posted: Fri 06 Nov 2009 14:13
by Shalex
Changing the model in the most cases will cause different errors in the frame of existing templates. We consider the possibility of implementing the C# scripts execution, that can modify a model without any problems. We plan to implement this functionality in the next version of Entity Developer.

double/decimal

Posted: Fri 06 Nov 2009 14:23
by HCRoman
:) :) :)

Ok, still waiting and merging....

Roman