Archive

Archive for September, 2011

CodeFluent Entities And The Store Concept

September 29, 2011 Leave a comment

CodeFluent Entities has a Store concept which you can use to sort entities of your model. A model can have several stores and your entities can be defined to be in a specific store.

image

Say you have an application storing referential entities in a specific database which might be used in the future by several other applications, as well as other entities that are specific to your application. Using the store concept is a way for you to separate define entities to be in one store , the one corresponding to your application for instance, and other entities to be in another, say the referential one for instance.

image

Then you can define several persistence producers in your project and assign each of them a specific store. As a consequence they’ll generate the code corresponding to their assigned store, and each producer can have a different connection string so these stores can actually be in different databases.

<cf:store name=”Referential” />
<cf:producer name=”SQL Server” typeName=”CodeFluent.Producers.SqlServer.SqlServerProducer, CodeFluent.Producers.SqlServer”>
<cf:configuration targetDirectory=”..\Persistence\Referential” storeName=”Referential”  />
</cf:producer>
<cf:producer name=”SQL Server” typeName=”CodeFluent.Producers.SqlServer.SqlServerProducer, CodeFluent.Producers.SqlServer”>
<cf:configuration targetDirectory=”..\Persistence\Advertising” storeName=”SoftFluent.Advertising”  />
</cf:producer>

Note: as of today (build 622) the Modeler doesn’t provide a “Store Name” property in the producer’s configuration property grid, however this will be available in the next version, in the advanced view.

Another point of interest is that by default, CodeFluent Entities doesn’t allow relations across different stores as entities can be in different databases, on potentially different servers (and even in different storage systems!), so stores might not be able to communicate with one another.

However if ever in practice stores are on the same server, and in the same database you can decide to override this behavior and this can be done by setting the allowCrossStoreRelations property on the project to true.

If it’s not your case, you know that stores should be on different servers in different servers, one could argue that at this point (separate producers and no cross-store relations) you might as well have one model for each store.
This is true in some scenarios, however, having all entities in the same model has its benefits such as centralizing all used business concepts, being able to define aspects and producers working on all entities at the same time.

In the end, it’s all up to you!

CodeFluent Entities Modeler: Importing Tables From The Visual Studio Server Explorer

September 28, 2011 2 comments

Using the Server Explorer in Visual Studio you can connect and view existing databases. For instance in this screenshot we opened the AdventureWorks sample database:

image

A handy feature of the Modeler is that dragging and dropping those tables from the Server Explorer onto the surface of your CodeFluent Entities project will automatically start the import wizard:

image

Configure your import and complete the wizard and your database was imported to your model!

image

CodeFluent Entities Runs On Windows 8 And Supports Visual Studio 11 Developer Preview

September 27, 2011 Leave a comment

Good news for CodeFluentees: you’ll be glad to know that CodeFluent Entities runs great on Windows 8 as well as Visual Studio 11 Developer Preview.

cfe_w8

This way upon Windows 8 and VS 11 arrivals, SoftFluent will provide support of all Visual Studio versions since Visual Studio 2008. Furthermore, please note that CodeFluent Entities projects use the same schema from one Visual Studio version to another. This way it allows developers to use different Visual Studio versions to work on the same CodeFluent Entities project Smile

cfe_w8_2

Adding Attributes On CodeFluent Entities Generated Properties

September 26, 2011 1 comment

CodeFluent Entities provides an attribute concept which can be defined on any other CodeFluent Entities concept. You can actually easily see this when navigating the documentation in the CodeFluent Schema Reference (in the Reference Guide):

image

As you can see all concepts (project, entity, property, method, rule, etc.) all support a sub-concept named attribute and it just so happens that this platform independent concept of an attribute is translated into an actual .NET attribute by the Business Object Model Producer. (NOTE: in fact, this is the default behavior, as an attribute can actually be anything you need. The attribute has a “class” property, and by default, this class is empty. Attributes with an empty class are translated by the BOM producer as .NET custom attributes)

Say for instance that you developed a handmade attribute named Sample in your project with a Description property which you’d like to set on one of your properties for instance.

Select your property and use the “Add Attribute” button in the ribbon:

image

A new dialog pops-up and lets you specify your attribute:

image

Note: using the “…” button you can use an already existing .NET attribute.

Then your attribute will appear on the surface under its related concept.

image

If you select your attribute, you’ll then be able to define its arguments from the Property Grid:

image

Clicking on the “…” button will open the following dialog in which you’ll be able to add your argument properties such as our Description property:

image

Then if you generate your model again with the BOM producer on, the generated Name property of the Customer class will look as follows:

[Sample(Description="This is a description!")]
(…)
public string Name
{
get
{
return this._name;
}
(…)

By the way, you can do all this in XML in your model as well:

<cf:entity name=”Customer”>
<cf:property name=”Id” />
<cf:property name=”Name”>
<cf:attribute name=”Sample”>
<cf:argument name=”Description” expression=”This is a description!” />
</cf:attribute>
</cf:property>
</cf:entity>

New CodeFluent Entities Version Available!

September 21, 2011 Leave a comment

This morning we released a new CodeFluent Entities build which is available as an internal build (as it’s still being tested): the 622.

image

 

In this version, a lot was done on the Modeler so don’t hesitate to use it as we’re getting closer to the final version!

Categories: News Tags: , ,

New Online Documentation Release: R12

September 20, 2011 Leave a comment

A new version (R12) of the product documentation was released!

This new version includes:

Additions:

  • New technical articles:
    • Generating Mobile-Enabled WCF Services Using CodeFluent Entities
    • Consuming Generated WCF Services in Android
    • Consuming Generated WCF Services in Windows Phone
    • Consuming Generated WCF Services in iOS
    • Creating A WPF Smart Client With Authentication Using CodeFluent Entities
    • Windows Workflow Foundation 4 and CodeFluent Entities
  • New tutorial:
    • Using the WPF Smart Client Producer
  • New article:
    • Hosting WCF Services

Updates:

  • Generating Text Files
  • Developing A Smart Client
  • Developing .NET Applications With Oracle Database
  • Importers articles
  • Developing Silverlight applications

As well as miscellaneous corrections and a new look :)

Interested in some extra articles? Comment this post and tell us what you’d like to see in the next release!

PS: if you receive 404 errors or if the TOC don’t show when browsing this new documentation version, please reset your browser cache.

CodeFluent Entities Type System

September 19, 2011 Leave a comment

CodeFluent Entities models are platform independent. Code generation isn’t template-based, instead, CodeFluent Entities infers a meta-model from your designed model and producers will then translate this inferred in-memory representation into actual code.

Regarding types, the process is basically as follows: from the type you defined in your model, CodeFluent Entities in its meta-model will infer a three types being:

  • a CLR type,
  • a Persistence type (i.e. a System.Data.DbType),
  • and a UI type.

Producers will then use those inferred types. For instance the Business Object Model producer will use the CLR type in the generated .NET Business Object Model (a.k.a. BOM), and persistence producers use the persistence type to translate it in their target platform.

image

 

Note: In your models you can also use platform specific code, such as explicitly defining that a column should be of a specific type.

CodeFluent Entities provides an extensive type system allowing you to design more or less anything. Here’s a list of the currently supported type system:



CodeFluent types & aliases CLR types Persistence types UI types
bool (boolean, bit) System.Boolean DbType.Boolean Boolean
byte System.Byte DbType.Byte Integer
char System.Char DbType.Byte if persistenceUnicode is set to false Character
currency (money, cost, price) System.Decimal DbType.Currency Currency
datetime (date, time) System.DateTime DbType.DateTime DateTime
double (real) System.Double DbType.Double Double
single (float) System.Single DbType.Single Single
object (any, anyvalue) System.Object DbType.Object AnyValue
guid (uniqueidentifier) System.Guid DbType.Guid UniqueIdentifier
decimal System.Decimal DbType.Decimal Number
sbyte System.SByte DbType.Sbyte Integer
elapsedtime (timespan) System.TimeSpan DbType.DateTime ElapsedTime
int (int32, integer) System.Int32 DbType.Int32 Integer
long (int64) System.Int64 DbType.Int64 Integer
short (int16) System.Int16 DbType.Int16 Integer
uint (uint32) System.UInt32 DbType.UInt32 Integer
ulong (uint64) System.UInt64 DbType.UInt64 Integer
ushort (uint16) System.UInt16 DbType.UInt16 Integer
byte System.Byte DbType.Byte Integer
xml System.String DbType.AnsiString if persistenceUnicode is set to false Xml
string (text) System.String DbType.AnsiString if persistenceUnicode is set to false Text
email (mail) System.String DbType.AnsiString if persistenceUnicode is set to false Email
password System.String DbType.AnsiString if persistenceUnicode is set to false Password
url (hyperlink) System.String DbType.AnsiString if persistenceUnicode is set to false HyperLink
richstring (richtext) System.String DbType.AnsiString if persistenceUnicode is set to false RichText
data (byte[], binary) System.Byte[] DbType.Binary Binary
file (attachment, document) CodeFluent Runtime provided DbType.Binary File
blob (largebinary) CodeFluent Runtime provided DbType.Binary BinaryLarge
film (video) CodeFluent Runtime provided DbType.Binary Video
image (picture, photo) CodeFluent Runtime provided DbType.Binary Image
audio (sound) CodeFluent Runtime provided DbType.Binary Audio

In the end those types will be translated into their target platform equivalent.

For instance, here’s how types are translated in the persistence layer:



Persistent Type SQL Server 2000/2005 SQL Server 2008 Oracle Database
DbType.Boolean bit bit NUMBER
DbType.Byte | DbType.Sbyte tinyint tinyint NUMBER
DbType.Currency money money NUMBER
DbType.DateTime datetime date DATE
DbType.Time datetime time TIMESTAMP
DbType.Date datetime date DATE
DbType.Decimal decimal decimal NUMBER
DbType.Double float float BINARY_DOUBLE
DbType.Guid uniqueidentifier uniqueidentifier RAW
DbType.UInt16 | DbType.Int16 smallint smallint NUMBER
DbType.UInt32 | DbType.Int32 int int NUMBER
DbType.UInt64 | DbType.Int64  bigint time NUMBER
DbType.Object sql_variant sql_variant BLOB
DbType.Single real real BINARY_FLOAT
DbType.AnsiString | DbType.AnsiStringFixedLength varchar | text varchar | text VARCHAR2 | CLOB
DbType.String | DbType.StringFixedLength nvarchar | ntext nvarchar | ntext NVARCHAR2 | NCLOB
DbType.Binary image | varbinary image | varbinary BLOB |RAW

Note: unknown model types are serialized and the serialization used can be configured.

Get CodeFluent Entities For Free

September 16, 2011 Leave a comment

CodeFluent Entities is free for a personal use and non-profit organizations, so go ahead and try it out!

To get the full, unrestricted, product register here, and make sure you select the Personal license type:

image

Once registered, download the product from your account page, install it and when prompted for your license key (on the first use), enter the license key displayed on your account page.

To access your account page, log-in on www.codefluententities.com, and your account page will show up by default.

On this page you’ll find all your license keys as well as a download link to the latest official build of the product:

image

 

Enjoy!

Categories: News Tags: , , ,

Environment Variables Support in CodeFluent Entities

September 15, 2011 1 comment

You can use environment variables in your CodeFluent Entities models by surrounding the environment variable name of ‘%’.

Example:

  • Specifying %COMPUTERNAME% in your model will use the COMPUTERNAME environment variable.

 

The fact that CodeFluent Entities supports environment variables is a key point as it allows us to create portable models.

For instance, CodeFluent Entities knows a key environment variable named “CF_DEFAULT_PERSISTENCE_SERVER”.

This environment variable is used by the default connection string used by producers and if not defined 127.0.0.1 is used.

So if all team members set this “CF_DEFAULT_PERSISTENCE_SERVER” to their proper persistence server, you then don’t have to specify connection strings in your models. Consequently, anyone can build each others model on their environment right-away without having to edit it.

Note: By the way a post was already dedicated to this environment variable: http://blog.codefluententities.com/2011/04/11/default-persistence-server/

 

To conclude, all connection strings or paths could be in such variables, making your life easier when retrieving a model which was designed by one of your teammate.

Carl

Multi-Database Support with CodeFluent Entities

September 14, 2011 Leave a comment

CodeFluent Entities provides several producer allowing you to generate your persistence layer on several database engines:

  • SQL Server 2000 (*), 2005, 2008, 2008 R2
  • Oracle Database 10g, 11g
  • SQL Azure

(*) SQL Server 2000 is supported but deprecated: we fix reported bugs for existing applications, but we don’t add any features to it any more.

Another key point is that the Business Object Model (BOM) generated by the BOM Producer is completely independent from the used persistence layer whilst remaining the same: you can plug the same BOM at run time on all your generated databases, provided they are all up-to-date.

 

Using CodeFluent Entities you can also create your model from an existing database. You can import a model from the following database systems:

  • Microsoft SQL Server
  • Microsoft SQL Server CE
  • Microsoft Access
  • Oracle Database
  • OLEDB

We’re also proud to announce that the next build will also provide a beta version of a MySQL database importer :)

Follow

Get every new post delivered to your Inbox.

Join 41 other followers