Kristian wrote:
Otis wrote:
There is a generalentity factory created for you in the entityfactories file, which accepts an EntityType and produces an empty entity for you
Hmm....i can't seem to find the file. Do you know what the name of the actuall class is? I'm using adapter.
Thanks!
Ah, no in adapter there is no such factory, as in adapter you need the entity factories themselves often, so such a general factory wasn't that helpful I thought. You can add one yourself though:
<[If HasEntity]>
''' <summary>
''' Factory to create new, empty Entity objects based on the entity type specified. Uses
''' entity specific factory objects
''' </summary>
<Serializable()> _
Public Class GeneralEntityFactory
''' <summary>
''' Creates a new, empty Entity object of the type specified
''' </summary>
''' <param name="entityTypeToCreate">The entity type to create.</param>
''' <returns>A new, empty Entity object.</returns>
Public Shared Function Create(entityTypeToCreate As EntityType) As IEntity2
Dim factoryToUse As IEntityFactory2 = Nothing
Select Case entityTypeToCreate
<[Foreach Entity CrLf]> Case <[RootNamespace]>.EntityType.<[CurrentEntityName]>Entity
factoryToUse = New <[CurrentEntityName]>EntityFactory()<[NextForeach]>
End Select
Return factoryToUse.Create()
End Function
End Class
<[EndIf]>